fork(8) download
  1. <?php
  2. $list = [
  3. ['status'=>'on'],
  4. ['status'=>'off']
  5. ];
  6. foreach($list as $key => &$item) {
  7. if($item['status'] === 'off') {
  8. unset($list[$key]);
  9. }
  10. }
  11. print_r($list); // array HAS changed!
  12. ?>
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Array
(
    [0] => Array
        (
            [status] => on
        )

)