Skip to content
Snippets Groups Projects
Commit c96f138a authored by Laurent's avatar Laurent
Browse files

restore array_column

parent 301c65d5
Branches
Tags
2 merge requests!1146Dev#29558 improve search performances,!1130Dev#29558 improve search performances
...@@ -19,6 +19,15 @@ ...@@ -19,6 +19,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
// compatibility with PHP < 5.5
if(!function_exists("array_column")) {
function array_column($array, $column_name) {
return array_map(function($element) use($column_name){return $element[$column_name];}, $array);
}
}
function array_first(array $array) { function array_first(array $array) {
$values = array_values($array); $values = array_values($array);
return $values[0]; return $values[0];
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment