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

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??

How do I find if a value is already in an array or not?

what is a array?

How do I remove the first element from an array?

im getting a Resource id #5 $rs_comp = mysql_query("select * from company where autoID='$row_settings[compid]'");



Custom Search