I have a PHP array that I am trying to split into 2 different arrays. I am trying to pull out any values that contain the word \"hidden\". So one array would contain all the v
You can use array_filter() function:
$myArray = array('item1', 'item2hidden', 'item3', 'item4', 'item5hidden'); $arr1 = array_filter($myArray, function($v) { return strpos($v, 'hidden') === false; }); $arr2 = array_diff($myArray, $arr1);
Demo