[ create a new paste ] login | about

Link: http://codepad.org/XNlmCPE9    [ raw code | output | fork ]

PHP, pasted on Apr 8:
1
2
3
4
5
6
7
8
9
10
11
<?php

    $array = array(1, 2, 3, 4, 5);

    foreach ($array as $item) {
      echo "$item\n";
      $array[] = $item;
    }

    print_r($array);
    var_dump(each($array));


Output:
1
2
3
4
5
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 4
    [4] => 5
    [5] => 1
    [6] => 2
    [7] => 3
    [8] => 4
    [9] => 5
)
array(4) {
  [1]=>
  int(2)
  ["value"]=>
  int(2)
  [0]=>
  int(1)
  ["key"]=>
  int(1)
}


Create a new paste based on this one


Comments: