3v4l.org

run code in 200+ PHP versions simultaneously
<?php $orders = array ( 0 => array ( 'customer' => '9999', 'number' => '315982', 'webNumber' => '310018735', 'finished' => '0', 'timeOfDelivery' => '20190511', 'typeOfDelivery' => 'Köres', 'deliveryName' => 'Hebes Testkund *PLOCKAS EJ!*', 'modifiedDate' => '2019-05-09 17:15:58', 'ourReference' => 'Webshop', 'yourReference' => 'Kenneth Hjelm', 'rows' => array ( 0 => array ( 'number' => 'fr1,011-0', 'name' => '*Papaya Coconut 6x250gr', 'weight' => '1.50', 'amount' => '6', 'price' => '32.50', 'unit' => 'fp', 'uHeader0' => 'RB', 'uHeader1' => 'SE', 'unit0' => '1', 'unit1' => '1', 'unit2' => '6', 'deliveredAmount' => '6', 'sum' => '195', ), ), 'createdDate' => '2019-05-14 21:56:01', ), 1 => array ( 'customer' => '9999', 'number' => '315979', 'webNumber' => '310018732', 'finished' => '0', 'timeOfDelivery' => '20190511', 'typeOfDelivery' => 'Köres', 'deliveryName' => 'Hebes Testkund *PLOCKAS EJ!', 'modifiedDate' => '2019-05-09 02:02:25', 'ourReference' => 'Webshop', 'yourReference' => 'Kenneth Hjelm', 'rows' => array ( 0 => array ( 'number' => 'ba1,14-0', 'name' => 'BANANER Chiquita Färg 4 GULA ', 'weight' => '18.30', 'amount' => '18.30', 'price' => '14.50', 'unit' => 'kg', 'uHeader0' => 'Ld', 'uHeader1' => 'EC', 'unit0' => '1', 'unit1' => '1', 'unit2' => '18.30', 'deliveredAmount' => '18.30', 'sum' => '265.35', ), ), 'createdDate' => '2019-05-14 21:56:01', ), 2 => array ( 'customer' => '9999', 'number' => '315981', 'webNumber' => '310018734', 'finished' => '0', 'timeOfDelivery' => '20190511', 'typeOfDelivery' => 'Köres', 'deliveryName' => 'Hebes Testkund *PLOCKAS EJ!', 'modifiedDate' => '2019-05-09 16:48:43', 'ourReference' => 'Webshop', 'yourReference' => 'Kenneth Hjelm', 'rows' => array ( 0 => array ( 'number' => 'ba1,14-0', 'name' => 'BANANER Chiquita Färg 4 GULA ', 'weight' => '18.30', 'amount' => '18.30', 'price' => '14.50', 'unit' => 'kg', 'uHeader0' => 'Ld', 'uHeader1' => 'EC', 'unit0' => '1', 'unit1' => '1', 'unit2' => '18.30', 'deliveredAmount' => '18.30', 'sum' => '265.35', ), ), 'createdDate' => '2019-05-14 21:56:01', ), 3 => array ( 'customer' => '9999', 'number' => '250325', 'webNumber' => NULL, 'finished' => '0', 'timeOfDelivery' => '20190514', 'typeOfDelivery' => 'Köres', 'deliveryName' => 'Hebes Testkund *PLOCKAS EJ!', 'modifiedDate' => '2019-05-14 13:24:16', 'ourReference' => 'Kenneth Hjelm', 'yourReference' => 'Kenneth Hjelm', 'rows' => array ( 0 => array ( 'number' => 'pä1,16-0', 'name' => 'PÄRON Anjou 100/110 RUCARAY', 'weight' => '-30', 'amount' => '-30', 'price' => '20.91', 'unit' => 'kg', 'uHeader0' => 'Ld', 'uHeader1' => 'CL', 'unit0' => '-2', 'unit1' => '-2', 'unit2' => '15', 'deliveredAmount' => '-30', 'sum' => '-627.30', ), ), 'createdDate' => '2019-05-14 13:24:23', ), 4 => array ( 'customer' => '9999', 'number' => '315984', 'webNumber' => '310018737', 'finished' => '0', 'timeOfDelivery' => '20190511', 'typeOfDelivery' => 'Köres', 'deliveryName' => 'Hebes Testkund *PLOCKAS EJ!', 'modifiedDate' => '2019-05-09 17:17:55', 'ourReference' => 'Webshop', 'yourReference' => 'Kenneth Hjelm', 'rows' => array ( 0 => array ( 'number' => 'ba1,14-0', 'name' => 'BANANER Chiquita Färg 4 GULA ', 'weight' => '18.30', 'amount' => '18.30', 'price' => '14.50', 'unit' => 'kg', 'uHeader0' => 'Ld', 'uHeader1' => 'EC', 'unit0' => '1', 'unit1' => '1', 'unit2' => '18.30', 'deliveredAmount' => '18.30', 'sum' => '265.35', ), ), 'createdDate' => '2019-05-14 21:56:01', ), 5 => array ( 'customer' => '9999', 'number' => '316015', 'webNumber' => '310018738', 'finished' => '0', 'timeOfDelivery' => '20190516', 'typeOfDelivery' => 'Köres', 'deliveryName' => 'Hebes Testkund *PLOCKAS EJ!', 'modifiedDate' => '2019-05-13 17:09:44', 'ourReference' => 'Webshop', 'yourReference' => 'Kenneth Hjelm', 'rows' => array ( 0 => array ( 'number' => 'ba1,14-0', 'name' => 'BANANER Chiquita Färg 4 GULA ', 'weight' => '18.30', 'amount' => '18.30', 'price' => '14.50', 'unit' => 'kg', 'uHeader0' => 'Ld', 'uHeader1' => 'EC', 'unit0' => '1', 'unit1' => '1', 'unit2' => '18.30', 'deliveredAmount' => '18.30', 'sum' => '265.35', ), ), 'createdDate' => '2019-05-13 17:10:01', ), 6 => array ( 'customer' => '9999', 'number' => '316016', 'webNumber' => '310018739', 'finished' => '0', 'timeOfDelivery' => '20190510', 'typeOfDelivery' => 'Köres', 'deliveryName' => 'Hebes Testkund *PLOCKAS EJ!', 'modifiedDate' => '2019-05-13 17:10:45', 'ourReference' => 'Webshop', 'yourReference' => 'Kenneth Hjelm', 'rows' => array ( 0 => array ( 'number' => 'ba1,14-0', 'name' => 'BANANER Chiquita Färg 4 GULA ', 'weight' => '36.60', 'amount' => '36.60', 'price' => '14.50', 'unit' => 'kg', 'uHeader0' => 'Ld', 'uHeader1' => 'EC', 'unit0' => '2', 'unit1' => '2', 'unit2' => '18.30', 'deliveredAmount' => '36.60', 'sum' => '530.70', ), ), 'createdDate' => '2019-05-14 21:56:01', ), 7 => array ( 'customer' => '9999', 'number' => '316018', 'webNumber' => '310018741', 'finished' => '0', 'timeOfDelivery' => '20190516', 'typeOfDelivery' => 'Köres', 'deliveryName' => 'Hebes Testkund *PLOCKAS EJ!', 'modifiedDate' => '2019-05-14 02:00:40', 'ourReference' => 'Webshop', 'yourReference' => 'Kenneth Hjelm', 'rows' => array ( 0 => array ( 'number' => 'ba1,14-0', 'name' => 'BANANER Chiquita Färg 4 GULA ', 'weight' => '18.30', 'amount' => '18.30', 'price' => '14.50', 'unit' => 'kg', 'uHeader0' => 'Ld', 'uHeader1' => 'EC', 'unit0' => '1', 'unit1' => '1', 'unit2' => '18.30', 'deliveredAmount' => '18.30', 'sum' => '265.35', ), ), 'createdDate' => '2019-05-14 02:01:02', ), 8 => array ( 'customer' => '9999', 'number' => '316017', 'webNumber' => '310018740', 'finished' => '0', 'timeOfDelivery' => '20190511', 'typeOfDelivery' => 'Köres', 'deliveryName' => 'Hebes Testkund *PLOCKAS EJ!', 'modifiedDate' => '2019-05-13 17:11:41', 'ourReference' => 'Webshop', 'yourReference' => 'Kenneth Hjelm', 'rows' => array ( 0 => array ( 'number' => 'ba1,14-0', 'name' => 'BANANER Chiquita Färg 4 GULA ', 'weight' => '36.60', 'amount' => '36.60', 'price' => '14.50', 'unit' => 'kg', 'uHeader0' => 'Ld', 'uHeader1' => 'EC', 'unit0' => '2', 'unit1' => '2', 'unit2' => '18.30', 'deliveredAmount' => '36.60', 'sum' => '530.70', ), ), 'createdDate' => '2019-05-14 21:56:01', ), 9 => array ( 'customer' => '9999', 'number' => '316019', 'webNumber' => '310018742', 'finished' => '0', 'timeOfDelivery' => '20190517', 'typeOfDelivery' => 'Köres', 'deliveryName' => 'Hebes Testkund *PLOCKAS EJ!', 'modifiedDate' => '2019-05-14 02:01:40', 'ourReference' => 'Webshop', 'yourReference' => 'Kenneth Hjelm', 'rows' => array ( 0 => array ( 'number' => 'ba1,14-0', 'name' => 'BANANER Chiquita Färg 4 GULA ', 'weight' => '18.30', 'amount' => '18.30', 'price' => '14.50', 'unit' => 'kg', 'uHeader0' => 'Ld', 'uHeader1' => 'EC', 'unit0' => '1', 'unit1' => '1', 'unit2' => '18.30', 'deliveredAmount' => '18.30', 'sum' => '265.35', ), ), 'createdDate' => '2019-05-14 02:02:01', ), 10 => array ( 'customer' => '9999', 'number' => '316020', 'webNumber' => '310018743', 'finished' => '0', 'timeOfDelivery' => '20190518', 'typeOfDelivery' => 'Köres', 'deliveryName' => 'Hebes Testkund *PLOCKAS EJ!', 'modifiedDate' => '2019-05-14 02:02:37', 'ourReference' => 'Webshop', 'yourReference' => 'Kenneth Hjelm', 'rows' => array ( 0 => array ( 'number' => 'ba1,14-0', 'name' => 'BANANER Chiquita Färg 4 GULA ', 'weight' => '18.30', 'amount' => '18.30', 'price' => '14.50', 'unit' => 'kg', 'uHeader0' => 'Ld', 'uHeader1' => 'EC', 'unit0' => '1', 'unit1' => '1', 'unit2' => '18.30', 'deliveredAmount' => '18.30', 'sum' => '265.35', ), ), 'createdDate' => '2019-05-14 02:03:01', ), ); usort( $orders, function ($a, $b) { return $b['timeOfDelivery'] <=> $a['timeOfDelivery']; } ); $group_date = null; foreach ($orders as $order) { if ($order['timeOfDelivery'] !== $group_date) { // new group $group_date = $order['timeOfDelivery']; echo "\n\n", $group_date, "\n--------\n"; } echo $order['number'], "\n"; }
based on bSfu5
Output for 7.1.25 - 7.3.5
20190518 -------- 316020 20190517 -------- 316019 20190516 -------- 316015 316018 20190514 -------- 250325 20190511 -------- 315982 315979 315981 315984 316017 20190510 -------- 316016