PHP Questions Home
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

How do I remove and view the last element of an array?


PHP expected you would want to do this quite often, and so there is a function that enables you to do just this. The function is called array_pop, and it works a little like this:

<?php

$values 
= array("I","Like","Sentences","That","Don't","Finish");
$discard array_pop($values);
echo 
"Bye bye to $discard...\n\n";
$sentence implode(" ",$values);
echo 
"$sentence";
?>


Which gives us the following output:

Bye bye to Finish...

I Like Sentences That Don't



ASK A QUESTION

More arrays PHP Questions

I have an array of a hundred or so lines, each line has data with "|" separated values. I need to scan through this array, and select the line whose first 5 characters matches a text string. Any ideas or questions?

when we retrieve values from db and show in drop-down list then how can i get selected particular value from drop-down so that programe will go next page??

hi, i am querying the DB as follows: $result=mysql_query("SELECT name,items FROM mytable WHERE user_id='$id'"); now,i want to create an array to insert the values that are as a result of this query e'g let's say this is the resultant data: n

what is a array?

i have a site named profile.php where i want to replace the following: http://www.youtube.com/watch?v=yoXE031j8d0 into: i know i could use str_replace to replace into ... but i need to know the URL so i can check if it rea



Custom Search