Voting

: three minus two?
(Example: nine)

The Note You're Voting On

massimo dot modica at tin dot it ΒΆ
15 years ago
If you forget to reset the array before each(), the same code may give different results with different php versions.

<?php

$a
= array(1,2,3);

foreach (
$a AS $k => $v) $a[$k] = 2*$v;

while(list(
$k2, $v2) = each($a)) { echo($v2."\n"); }

?>

In PHP 5.2.0:

2
4
6

In PHP 5.2.6:

4
6

<< Back to user notes page

To Top