Could some one please give me a hand on this, I'm going nuts!
I whant to print the balue in the array tha proceeds the value of $MyValue. But it just doesn't work!
Look at this:
$MyArray = array(1,2,3,22,32,12);
$MyValue = 3;
foreach($MyArray as $value){
if($value == $MyValue){
print("$value |");
echo prev($MyArray);
print("<br>");
}
}
I want it to print '3 | 2' but the result is '3 | '
If I try with next() it works fine, i.e the result is '3 | 22'
Any ideas?
Regard...
Johan