fork(3) download
  1. <?php
  2.  
  3. $arr = Array(16, 17, 18, 23, 7, 6, 14, 22);
  4. $split_by = array_search(23, $arr);
  5.  
  6. if ($split_by) {
  7. $first = array_slice($arr, 0, $split_by);
  8. $second = array_slice($arr, $split_by);
  9.  
  10. var_dump($first, $second);
  11. }
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
array(3) {
  [0]=>
  int(16)
  [1]=>
  int(17)
  [2]=>
  int(18)
}
array(5) {
  [0]=>
  int(23)
  [1]=>
  int(7)
  [2]=>
  int(6)
  [3]=>
  int(14)
  [4]=>
  int(22)
}