fork(1) download
  1. <?php
  2.  
  3. $a=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  4. $count = count($a);
  5.  
  6. for($i = 1; $i <= $count; $i += 2) {
  7. unset($a[$i]);
  8. }
  9.  
  10. print_r($a);
Success #stdin #stdout 0.01s 24416KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 1
    [2] => 3
    [4] => 5
    [6] => 7
    [8] => 9
)