I wrote tiny utility method - which is for extracting values on specific key in array.
The result should be:
Code
function extractValuesForSpecificKey(array& $sourceArray, $key){ $retArray = array(); foreach ($sourceArray as $sourceElem){ $retArray[] = $sourceElem[$key]; } return $retArray; }
Example
$source = array( array('id' => 1, 'name' =>'Joe'), array('id' => 2, 'name' =>'Chris'), ); $result = extractValuesForSpecificKey($source, 'id'); var_dump($result);
The result should be:
array(2) { [0]=> int(1) [1]=> int(2) }
コメント
Functions used to define a schedule of holidays