In this tutorial learn how to remove the last value from an array in php.
TUTORIAL
OUTPUT
function removeLastelement($array)
{
array_pop($array);
return $array;
}
TUTORIAL
<?php
$array = Array
(
'3' => 10,
'2' => 2,
'5' => 'Nakiya',
);
/**
* Remove the last value from an array
*/
function removeLastelement($array)
{
array_pop($array);
return $array;
}
var_dump(removeLastelement($array));
array(2) {
[3]=>
int(10)
[2]=>
int(2)
}
No comments:
Post a Comment