sort - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of sort.php
- <?php
- $arr = [
- 0 => [
- 'date' => '12/10/2018',
- 'info' => 'aaa',
- 'exclude' => true
- ],
- 1 => [
- 'date' => '12/08/2018',
- 'info' => 'bbb',
- 'exclude' => true
- ],
- 2 => [
- 'date' => '12/12/2018',
- 'info' => 'ccc'
- ],
- 3 => [
- 'date' => '12/07/2018',
- 'info' => 'ddd'
- ],
- 4 => [
- 'date' => '12/14/2018',
- 'info' => 'eee'
- ],
- 5 => [
- 'date' => '12/05/2018',
- 'info' => 'fff'
- ]
- ];
- function sortFunction($a, $b) {
- return strtotime($a['date']) - strtotime($b['date']);
- }
- usort($arr, 'sortFunction');
- var_dump($arr);
File Description
- sort
- PHP Code
- 13 Apr-2018
- 631 Bytes
You can Share it:
Latest PHP Pastes