3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ 124 => [ 'releaseDate' => '2020-07-01 00:00:00', 'isNewest' => true, ], 110 => [ 'releaseDate' => '2020-08-15 00:00:00', 'isNewest' => false, ], 129 => [ 'releaseDate' => '2020-08-15 00:00:00', 'isNewest' => true, ], 128 => [ 'releaseDate' => '2020-08-15 00:00:00', 'isNewest' => false, ], 130 => [ 'releaseDate' => '2020-08-15 00:00:00', 'isNewest' => false, ], 131 => [ 'releaseDate' => '2020-08-15 00:00:00', 'isNewest' => false, ], 132 => [ 'releaseDate' => '2020-08-15 00:00:00', 'isNewest' => false, ], 123 => [ 'releaseDate' => '2020-07-01 00:00:00', 'isNewest' => false, ], 125 => [ 'releaseDate' => '2020-07-01 00:00:00', 'isNewest' => false, ], 127 => [ 'releaseDate' => '2020-07-01 00:00:00', 'isNewest' => false, ], ]; uasort($array, function ($a, $b) { // sort true values first if ($a['isNewest'] && !$b['isNewest']) return -1; elseif (!$a['isNewest'] && $b['isNewest']) return 1; // boolean values are equal, so sort by date. // Since dates are in Y-m-d H:i:s format, we can sort as strings else return strcmp($a['releaseDate'], $b['releaseDate']); }); print_r($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LoN4W
function name:  (null)
number of ops:  10
compiled vars:  !0 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   46     1        INIT_FCALL                                                   'uasort'
          2        SEND_REF                                                     !0
          3        DECLARE_LAMBDA_FUNCTION                              ~2      [0]
   53     4        SEND_VAL                                                     ~2
   46     5        DO_ICALL                                                     
   54     6        INIT_FCALL                                                   'print_r'
          7        SEND_VAR                                                     !0
          8        DO_ICALL                                                     
          9      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 46) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 7
filename:       /in/LoN4W
function name:  {closure:/in/LoN4W:46}
number of ops:  26
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   46     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   48     2        FETCH_DIM_R                                          ~2      !0, 'isNewest'
          3      > JMPZ_EX                                              ~2      ~2, ->7
          4    >   FETCH_DIM_R                                          ~3      !1, 'isNewest'
          5        BOOL_NOT                                             ~4      ~3
          6        BOOL                                                 ~2      ~4
          7    > > JMPZ                                                         ~2, ->10
          8    > > RETURN                                                       -1
          9*       JMP                                                          ->25
   49    10    >   FETCH_DIM_R                                          ~5      !0, 'isNewest'
         11        BOOL_NOT                                             ~6      ~5
         12      > JMPZ_EX                                              ~6      ~6, ->15
         13    >   FETCH_DIM_R                                          ~7      !1, 'isNewest'
         14        BOOL                                                 ~6      ~7
         15    > > JMPZ                                                         ~6, ->18
         16    > > RETURN                                                       1
         17*       JMP                                                          ->25
   52    18    >   INIT_FCALL                                                   'strcmp'
         19        FETCH_DIM_R                                          ~8      !0, 'releaseDate'
         20        SEND_VAL                                                     ~8
         21        FETCH_DIM_R                                          ~9      !1, 'releaseDate'
         22        SEND_VAL                                                     ~9
         23        DO_ICALL                                             $10     
         24      > RETURN                                                       $10
   53    25*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.1 ms | 2393 KiB | 16 Q