note 112516 deleted from function.array-column by peehaa

From: Date: Mon, 15 Jul 2013 15:34:07 +0000
Subject: note 112516 deleted from function.array-column by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-195624@lists.php.net to get a copy of this message
Note Submitter: piotrek290 at gmail dot com ---- It's my array_column function for PHP < 5.5.0 function array_column($input, $column_key, $index_key=''){ $array_filtered = array(); if(is_array($input)){ foreach($input as $array){ if(is_array($array)){ foreach($array as $key => $value){ if($index_key){ if(array_key_exists($index_key, $array)){ if($key == $column_key){ $array_filtered[$array[$index_key]] = $value; } else { if($key == $column_key){ array_push($array_filtered, $value); } } } } else { if($key == $column_key){ array_push($array_filtered, $value); } } } } } } return $array_filtered; }

« previous php.notes (#195624) next »