php example code : array_pop function in php - pops the last value of given array
array-pop-example-in-php.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>php example code : array_pop function in php - pops the last value of given array</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Md Iqbal Hosan">
<meta name="title" content="php example code : array_pop function in php - pops the last value of given array">
<meta name="keywords" content="php, example, code, array, function, array_pop">
<meta name="description" content="php example code : array_pop function in php - pops the last value of given array">
</head>
<body>
<h3>php example code : array_pop function in php - pops the last value of given array</h3>
<?php
/*
------------------------------------------------
let us make an array with some keys and values
------------------------------------------------
*/
$myArray1 = array("key1"=>"value1","key2"=>"value2","key3"=>"value3");
echo "<p style='background:#aaa; color:red;'>Output of myArray1</p>";
echo "<pre>";
print_r($myArray1);
echo "</pre>";
/*
--------------------------------------------------------------------------
now we want delete or pop up the last element by using array_pop function
--------------------------------------------------------------------------
*/
$popUpValue = array_pop($myArray1);
echo "<p style='background:#ddd; color:red;'>Output of popUpValue using array_pop function</p>";
echo "<pre>";
print_r($popUpValue);
echo "</pre>";
?>
</body>
</html>

No comments:
Post a Comment
leave your comments here..