So I tried doing this :
$array = array('first'=>'111', 'second'=>'222', 'third'=>'333');
var_dump(prev($array["second"]));
Hoping to get 111
but I get NULL
. Why?
$array["second"]
returns 222
. Shouldn't we get 111
when we use PHP's prev()
function?
How to get the previous value of an array if it exists using the key?