3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sortDurations($a, $b) { if (strcmp($a['start'], $b['start']) == 0) { return 0; } else if (strcmp($a['start'], $b['start']) < 0) { return -1; } else if (strcmp($a['start'], $b['start']) > 0) { return 1; } return 0; } $tab = array(); $tab [] = array('start'=>'10:00:00','finish'=>'10:30:00'); $tab [] = array('start'=>'11:00:00','finish'=>'11:00:00'); $tab [] = array('start'=>'12:00:00','finish'=>'12:30:00'); $tab [] = array('start'=>'08:00:00','finish'=>'08:30:00'); $tab [] = array('start'=>'09:00:00','finish'=>'09:30:00'); $tab [] = array('start'=>'14:00:00','finish'=>'14:30:00'); $tab = array($tab); /**echo "avant tri <pre>"; print_r($tab); echo "</pre>"; **/ echo json_encode($tab); uasort($tab, 'sortDurations' ); echo "\r\n"; /** echo "apres tri <pre>"; var_dump($tab); echo "</pre>"; **/ echo json_encode($tab); echo "\r\n"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5jrJB
function name:  (null)
number of ops:  30
compiled vars:  !0 = $tab
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   22     1        ASSIGN_DIM                                               !0
          2        OP_DATA                                                  <array>
   23     3        ASSIGN_DIM                                               !0
          4        OP_DATA                                                  <array>
   24     5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  <array>
   25     7        ASSIGN_DIM                                               !0
          8        OP_DATA                                                  <array>
   26     9        ASSIGN_DIM                                               !0
         10        OP_DATA                                                  <array>
   27    11        ASSIGN_DIM                                               !0
         12        OP_DATA                                                  <array>
   29    13        INIT_ARRAY                                       ~8      !0
         14        ASSIGN                                                   !0, ~8
   35    15        INIT_FCALL                                               'json_encode'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                         $10     
         18        ECHO                                                     $10
   37    19        INIT_FCALL                                               'uasort'
         20        SEND_REF                                                 !0
         21        SEND_VAL                                                 'sortDurations'
         22        DO_ICALL                                                 
   39    23        ECHO                                                     '%0D%0A'
   46    24        INIT_FCALL                                               'json_encode'
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                         $12     
         27        ECHO                                                     $12
   47    28        ECHO                                                     '%0D%0A'
   49    29      > RETURN                                                   1

Function sortdurations:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 31
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5jrJB
function name:  sortDurations
number of ops:  33
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'strcmp'
          3        FETCH_DIM_R                                      ~2      !0, 'start'
          4        SEND_VAL                                                 ~2
          5        FETCH_DIM_R                                      ~3      !1, 'start'
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8        IS_EQUAL                                                 $4, 0
          9      > JMPZ                                                     ~5, ->12
    7    10    > > RETURN                                                   0
         11*       JMP                                                      ->31
    9    12    >   INIT_FCALL                                               'strcmp'
         13        FETCH_DIM_R                                      ~6      !0, 'start'
         14        SEND_VAL                                                 ~6
         15        FETCH_DIM_R                                      ~7      !1, 'start'
         16        SEND_VAL                                                 ~7
         17        DO_ICALL                                         $8      
         18        IS_SMALLER                                               $8, 0
         19      > JMPZ                                                     ~9, ->22
   11    20    > > RETURN                                                   -1
         21*       JMP                                                      ->31
   13    22    >   INIT_FCALL                                               'strcmp'
         23        FETCH_DIM_R                                      ~10     !0, 'start'
         24        SEND_VAL                                                 ~10
         25        FETCH_DIM_R                                      ~11     !1, 'start'
         26        SEND_VAL                                                 ~11
         27        DO_ICALL                                         $12     
         28        IS_SMALLER                                               0, $12
         29      > JMPZ                                                     ~13, ->31
   15    30    > > RETURN                                                   1
   17    31    > > RETURN                                                   0
   18    32*     > RETURN                                                   null

End of function sortdurations

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.19 ms | 1392 KiB | 19 Q