//an array of some songs I like
$employee = array(
'1' => array('name'=>'Hanzala Subhani', 'job_title'=>'Software Developer'),
'2' => array('name'=>'Safdar Subhani', 'job_title'=>'Software Developer'),
'3' => array('name'=>'Shamsh Jawed', 'job_title' =>'Manager')
);
function sort_employee($a,$subkey) {
foreach($a as $k=>$v) {
$b[$k] = strtolower($v[$subkey]);
}
asort($b);
foreach($b as $key=>$val) {
$c[] = $a[$key];
}
return $c;
}
$employee = sort_employee($employee,'artist');
print_r($employee);
Friday, February 17, 2012
Sorting a Multi-Dimensional Array with PHP
Wednesday, February 8, 2012
Friday, February 3, 2012
Thursday, February 2, 2012
Wednesday, February 1, 2012
Subscribe to:
Posts (Atom)