Posts: 876
Name: Matt Pealing
Location: England, north west
|
Is this code:
PHP Code:
for ($i = 0; $i < $num; $i ++) { if ($portIdNav[$i] == $portId) { echo $portId . ' is in index ' . $i . '<br>'; $portIdNext = $portIdNav[$i + 1]; $portIdPrev = $portIdNav[$i - 1]; echo 'Next is ' . $portIdNext . ' and Prev is ' . $portIdPrev; } }
equivalent to this?
PHP Code:
for ($i = 0; $i < $num; $i ++) { if ($portIdNav[$i] == $portId) { echo $portId . ' is in index ' . $i . '<br>'; $portIdNext = $portIdNav[$i ++]; $portIdPrev = $portIdNav[$i --]; echo 'Next is ' . $portIdNext . ' and Prev is ' . $portIdPrev; } }
Ive always thought it was, but it gives me different results!
In case you cant spot the difference, its where the ++ and -- lie on the second code sample
Last edited by pealo86; 07-10-2008 at 12:10 PM..
|