3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data[] = array('volume' => 67, 'edition' => 2); $data[] = array('volume' => 86, 'edition' => 1); $data[] = array('volume' => 85, 'edition' => 6); $data[] = array('volume' => 98, 'edition' => 2); $data[] = array('volume' => 86, 'edition' => 6); $data[] = array('volume' => 67, 'edition' => 7); $arr = array(); $cert = new stdClass(); $cert->Hash = '1132775296C8A1A3A7BDE742089458B7D3F8FD64'; $cert->SerialNumber = '424DB63300050000D15B'; $cert->KeyDate = date('d.n.Y', strtotime('2009-10-20 12:47:00')); $cert->ExpDate = date('d.n.Y', strtotime('2010-10-20 12:57:00')); $cert->TypeID = 1; $cert->TypeName = 'Федеральный'; $cert->StatusID = 2; $cert->StatusName = 'недействующий'; $cert->PersonID = '581'; $cert->PersonName = 'Иванов Иван Иванович'; $arr[] = $cert; $cert = new stdClass(); $cert->Hash = '2132775296C8A1A3A7BDE742089458B7D3F8FD64'; $cert->SerialNumber = '424DB63300050000D15B'; $cert->KeyDate = date('d.n.Y', strtotime('2010-10-20 12:57:00')); $cert->ExpDate = date('d.n.Y', strtotime('2011-10-20 12:57:00')); $cert->TypeID = 1; $cert->TypeName = 'Федеральный'; $cert->StatusID = 2; $cert->StatusName = 'недействующий'; $cert->PersonID = '581'; $cert->PersonName = 'Петров Петр Петрович'; $arr[] = $cert; $cert = new stdClass(); $cert->Hash = '3132775296C8A1A3A7BDE742089458B7D3F8FD64'; $cert->SerialNumber = '424DB63300050000D15B'; $cert->KeyDate = date('d.n.Y', strtotime('2011-10-20 12:57:00')); $cert->ExpDate = date('d.n.Y', strtotime('2012-10-20 12:57:00')); $cert->TypeID = 1; $cert->TypeName = 'Федеральный'; $cert->StatusID = 2; $cert->StatusName = 'недействующий'; $cert->PersonID = '581'; $cert->PersonName = 'Сидоров Сидр Сидорович'; $arr[] = $cert; $volume = array(); // Получение списка столбцов foreach ($cert as $key => $row) { $volume[$key] = $row->KeyDate; } // Сортируем данные по volume по убыванию и по edition по возрастанию // Добавляем $data в качестве последнего параметра, для сортировки по общему ключу array_multisort($volume, SORT_DESC, $cert); print_r($cert);
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
Warning: Attempt to read property "KeyDate" on string in /in/dltBg on line 55 Warning: Attempt to read property "KeyDate" on string in /in/dltBg on line 55 Warning: Attempt to read property "KeyDate" on string in /in/dltBg on line 55 Warning: Attempt to read property "KeyDate" on string in /in/dltBg on line 55 Warning: Attempt to read property "KeyDate" on int in /in/dltBg on line 55 Warning: Attempt to read property "KeyDate" on string in /in/dltBg on line 55 Warning: Attempt to read property "KeyDate" on int in /in/dltBg on line 55 Warning: Attempt to read property "KeyDate" on string in /in/dltBg on line 55 Warning: Attempt to read property "KeyDate" on string in /in/dltBg on line 55 Warning: Attempt to read property "KeyDate" on string in /in/dltBg on line 55 Fatal error: Uncaught TypeError: array_multisort(): Argument #3 must be an array or a sort flag in /in/dltBg:60 Stack trace: #0 /in/dltBg(60): array_multisort(Array, 3, Object(stdClass)) #1 {main} thrown in /in/dltBg on line 60
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Trying to get property 'KeyDate' of non-object in /in/dltBg on line 55 Notice: Trying to get property 'KeyDate' of non-object in /in/dltBg on line 55 Notice: Trying to get property 'KeyDate' of non-object in /in/dltBg on line 55 Notice: Trying to get property 'KeyDate' of non-object in /in/dltBg on line 55 Notice: Trying to get property 'KeyDate' of non-object in /in/dltBg on line 55 Notice: Trying to get property 'KeyDate' of non-object in /in/dltBg on line 55 Notice: Trying to get property 'KeyDate' of non-object in /in/dltBg on line 55 Notice: Trying to get property 'KeyDate' of non-object in /in/dltBg on line 55 Notice: Trying to get property 'KeyDate' of non-object in /in/dltBg on line 55 Notice: Trying to get property 'KeyDate' of non-object in /in/dltBg on line 55 Warning: array_multisort(): Argument #3 is expected to be an array or a sort flag in /in/dltBg on line 60 stdClass Object ( [Hash] => 3132775296C8A1A3A7BDE742089458B7D3F8FD64 [SerialNumber] => 424DB63300050000D15B [KeyDate] => 20.10.2011 [ExpDate] => 20.10.2012 [TypeID] => 1 [TypeName] => Федеральный [StatusID] => 2 [StatusName] => недействующий [PersonID] => 581 [PersonName] => Сидоров Сидр Сидорович )
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9, 7.3.32 - 7.3.33
Warning: array_multisort(): Argument #3 is expected to be an array or a sort flag in /in/dltBg on line 60 stdClass Object ( [Hash] => 3132775296C8A1A3A7BDE742089458B7D3F8FD64 [SerialNumber] => 424DB63300050000D15B [KeyDate] => 20.10.2011 [ExpDate] => 20.10.2012 [TypeID] => 1 [TypeName] => Федеральный [StatusID] => 2 [StatusName] => недействующий [PersonID] => 581 [PersonName] => Сидоров Сидр Сидорович )
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33
Notice: Trying to get property of non-object in /in/dltBg on line 55 Notice: Trying to get property of non-object in /in/dltBg on line 55 Notice: Trying to get property of non-object in /in/dltBg on line 55 Notice: Trying to get property of non-object in /in/dltBg on line 55 Notice: Trying to get property of non-object in /in/dltBg on line 55 Notice: Trying to get property of non-object in /in/dltBg on line 55 Notice: Trying to get property of non-object in /in/dltBg on line 55 Notice: Trying to get property of non-object in /in/dltBg on line 55 Notice: Trying to get property of non-object in /in/dltBg on line 55 Notice: Trying to get property of non-object in /in/dltBg on line 55 Warning: array_multisort(): Argument #3 is expected to be an array or a sort flag in /in/dltBg on line 60 stdClass Object ( [Hash] => 3132775296C8A1A3A7BDE742089458B7D3F8FD64 [SerialNumber] => 424DB63300050000D15B [KeyDate] => 20.10.2011 [ExpDate] => 20.10.2012 [TypeID] => 1 [TypeName] => Федеральный [StatusID] => 2 [StatusName] => недействующий [PersonID] => 581 [PersonName] => Сидоров Сидр Сидорович )
Output for 4.3.0 - 4.3.1
Warning: array_multisort() [http://www.php.net/function.array-multisort]: Argument #3 is expected to be an array or a sort flag in /in/dltBg on line 60 stdClass Object ( [Hash] => 3132775296C8A1A3A7BDE742089458B7D3F8FD64 [SerialNumber] => 424DB63300050000D15B [KeyDate] => 20.10.2011 [ExpDate] => 20.10.2012 [TypeID] => 1 [TypeName] => Федеральный [StatusID] => 2 [StatusName] => недействующий [PersonID] => 581 [PersonName] => Сидоров Сидр Сидорович )

preferences:
323.84 ms | 402 KiB | 401 Q