I have this array:
array(1) {
["dump"]=>
string(38) "["24.0",24.1,24.2,24.3,24.4,24.5,24.6]"
}
my question:how to get the first and the last element out from this array,
so i will have:
$firstEle = "24.0"; and $lastEle = "24.6"
;
Solution:
<?php
$array = array(24.0,24.1,24.2,24.3,24.4,24.5,24.6);
$first = reset($array);
$last = end($array);
var_dump($first, $last);
?>
0 comments:
Post a Comment