<?php
set_error_handler(function($errno, $errstr) {
$bt = debug_backtrace();
var_dump($errstr);
});
$input = array(
'first' => array(),
'second' => array('position' => 2),
array('something' => 5),
NULL => array('error' => 1),
);
$displays = array();
foreach ($input as $key => $options) {
$options += array(
'display_options' => array(),
'display_plugin' => NULL,
'id' => NULL,
'display_title' => '',
'position' => NULL,
);
// Add the defaults for the display.
$displays[$key] = $options;
}
uasort($displays, function ($display1, $display2) {
if ($display1['position'] != $display2['position']) {
return $display1['position'] < $display2['position'] ? -1 : 1;
}
return 0;
});
print_r($displays);
preferences:
40.36 ms | 402 KiB | 5 Q