@ 2015-09-11T14:20:55Z <?php
$menu = array(
array(1,3,'Wurm 1.1', 2, 10),
array(2,6,'Vogel 2.1', 2, 30),
array(3,0,'Tiger 1', 1, 10),
array(4,6,'Hund 2.2', 2, 40),
array(5,3,'Katze 1.2', 2, 11),
array(6,0,'Pferd 2', 1, 20),
array(7,1,'Baer 1.1.1', 3, 0),
array(8,3,'Schwein 1.3', 2, 12),
array(9,4,'Esel 2.2.1', 3, 0),
);
// Algorithmus hier
$result = array();
foreach ($menu as $entry) {
$result[substr(strrchr($entry[2], ' '), 1)] = $entry;
}
ksort($result, SORT_NATURAL);
$result = array_values($result);
$target = array(
array(3,0,'Tiger 1', 1, 10),
array(1,3,'Wurm 1.1', 2, 10),
array(7,1,'Baer 1.1.1', 3, 0),
array(5,3,'Katze 1.2', 2, 11),
array(8,3,'Schwein 1.3', 2, 12),
array(6,0,'Pferd 2', 1, 20),
array(2,6,'Vogel 2.1', 2, 30),
array(4,6,'Hund 2.2', 2, 40),
array(9,4,'Esel 2.2.1', 3, 0),g
);
var_dump($result == $target);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Fatal error: Uncaught Error: Undefined constant "g" in /in/i3DRW:34
Stack trace:
#0 {main}
thrown in /in/i3DRW on line 34
Process exited with code 255 . Output for 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 Warning: Use of undefined constant g - assumed 'g' (this will throw an Error in a future version of PHP) in /in/i3DRW on line 34
bool(false)
Output for 7.0.0 - 7.0.20 , 7.1.0 - 7.1.33 Notice: Use of undefined constant g - assumed 'g' in /in/i3DRW on line 34
bool(false)
Output for 5.4.2 - 5.4.45 , 5.5.24 - 5.5.35 , 5.6.8 - 5.6.28 Notice: Use of undefined constant g - assumed 'g' in /in/i3DRW on line 35
bool(false)
preferences:dark mode live preview
192.25 ms | 402 KiB | 269 Q