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 ['7'] = array('start'=>'14:00:00','finish'=>'14:30:00'); echo "avant tri <pre>"; print_r($tab); echo "</pre>"; uasort($tab, 'sortDurations' ); echo "apres tri <pre>"; var_dump($tab); echo "</pre>"; echo json_encode($tab); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YZ3nI
function name:  (null)
number of ops:  32
compiled vars:  !0 = $tab
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   ASSIGN                                                   !0, <array>
   21     1        ASSIGN_DIM                                               !0
          2        OP_DATA                                                  <array>
   22     3        ASSIGN_DIM                                               !0
          4        OP_DATA                                                  <array>
   23     5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  <array>
   24     7        ASSIGN_DIM                                               !0
          8        OP_DATA                                                  <array>
   25     9        ASSIGN_DIM                                               !0
         10        OP_DATA                                                  <array>
   26    11        ASSIGN_DIM                                               !0, 7
         12        OP_DATA                                                  <array>
   29    13        ECHO                                                     'avant+tri+%3Cpre%3E'
   30    14        INIT_FCALL                                               'print_r'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                                 
   31    17        ECHO                                                     '%3C%2Fpre%3E'
   33    18        INIT_FCALL                                               'uasort'
         19        SEND_REF                                                 !0
         20        SEND_VAL                                                 'sortDurations'
         21        DO_ICALL                                                 
   35    22        ECHO                                                     'apres+tri+%3Cpre%3E'
   36    23        INIT_FCALL                                               'var_dump'
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                                 
   37    26        ECHO                                                     '%3C%2Fpre%3E'
   39    27        INIT_FCALL                                               'json_encode'
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                         $11     
         30        ECHO                                                     $11
   42    31      > 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/YZ3nI
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:
175.05 ms | 1400 KiB | 23 Q