<?php $arr = Array(16, 17, 18, 23, 7, 6, 14, 22);$split_by = array_search(23, $arr); if ($split_by) { $first = array_slice($arr, 0, $split_by); $second = array_slice($arr, $split_by); var_dump($first, $second);}
Standard input is empty
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) }
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!