A better idea would be to use reset , which "rewinds the internal pointer of the array to the first element and returns the value of the first element of the array"
Example:
function Get1stArrayValue($arr) { return reset($arr); }
@therefromhere, , , . , , , , array_pop reset it.
, , , foreach . PHP :
, foreach , .
:
$arr = array("a", "b", "c", "d");
foreach ( $arr as $val ){
echo reset($arr) . " - " . $val . "\n";
}
:
a - a
a - b
a - c
a - d