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'); $b_date = DateTime::createFromFormat('Y-M'); 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/OgpLb
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 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
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
filename:       /in/OgpLb
function name:  sortFileNamesWithMonths
number of ops:  20
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        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !2, $4
    7     6        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          7        SEND_VAL                                                 'Y-M'
          8        DO_FCALL                                      0  $6      
          9        ASSIGN                                                   !3, $6
    8    10        IS_SMALLER                                               !3, !2
         11      > JMPZ                                                     ~8, ->14
    9    12    > > RETURN                                                   1
         13*       JMP                                                      ->19
   10    14    >   IS_SMALLER                                               !2, !3
         15      > JMPZ                                                     ~9, ->18
   11    16    > > RETURN                                                   -1
         17*       JMP                                                      ->19
   13    18    > > RETURN                                                   0
   15    19*     > RETURN                                                   null

End of function sortfilenameswithmonths

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.75 ms | 1396 KiB | 17 Q