3v4l.org

run code in 300+ PHP versions simultaneously
<?php $files = array('2014-Aug','2014-Jan','2013-Dec'); function sortFileNamesWithMonths($a,$b) { $a_date = DateTime::createFromFormat('Y-M',$a); $b_date = DateTime::createFromFormat('Y-M',$b); if ($a_date > $b_date) { return 1; } elseif ($a_date < $b_date) { return -1; } else { return 0; } } usort($files,'sortFileNamesWithMonths'); var_dump($files);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WSaS3
function name:  (null)
number of ops:  9
compiled vars:  !0 = $files
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'sortFileNamesWithMonths'
          4        DO_ICALL                                                 
   19     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function sortfilenameswithmonths:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WSaS3
function name:  sortFileNamesWithMonths
number of ops:  22
compiled vars:  !0 = $a, !1 = $b, !2 = $a_date, !3 = $b_date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          3        SEND_VAL                                                 'Y-M'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $4      
          6        ASSIGN                                                   !2, $4
    7     7        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          8        SEND_VAL                                                 'Y-M'
          9        SEND_VAR                                                 !1
         10        DO_FCALL                                      0  $6      
         11        ASSIGN                                                   !3, $6
    8    12        IS_SMALLER                                               !3, !2
         13      > JMPZ                                                     ~8, ->16
    9    14    > > RETURN                                                   1
         15*       JMP                                                      ->21
   10    16    >   IS_SMALLER                                               !2, !3
         17      > JMPZ                                                     ~9, ->20
   11    18    > > RETURN                                                   -1
         19*       JMP                                                      ->21
   13    20    > > RETURN                                                   0
   15    21*     > RETURN                                                   null

End of function sortfilenameswithmonths

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.57 ms | 1396 KiB | 17 Q