[ create a new paste ] login | about

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

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

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

    foreach ($array as $key => $item) {
      echo "$item\n";
      unset($array[$key + 1]);
    }

    print_r($array);


Output:
1
2
3
4
5
6
7
8
9
1
2
3
4
5
Array
(
    [0] => 1
)


Create a new paste based on this one


Comments: