3v4l.org

run code in 300+ PHP versions simultaneously
<?php function csort($a, $b) { $a = preg_split("/\s+/", $a); $b = preg_split("/\s+/", $b); return version_compare($a[1], $b[1]); } $r = array('abc 1.1', 'abc 1.0', 'abc 1.1.1'); usort($r, "csort"); print_r($r);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2IG7n
function name:  (null)
number of ops:  9
compiled vars:  !0 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'csort'
          4        DO_ICALL                                                 
   12     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function csort:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2IG7n
function name:  csort
number of ops:  20
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'preg_split'
          3        SEND_VAL                                                 '%2F%5Cs%2B%2F'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !0, $2
    5     7        INIT_FCALL                                               'preg_split'
          8        SEND_VAL                                                 '%2F%5Cs%2B%2F'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $4      
         11        ASSIGN                                                   !1, $4
    6    12        INIT_FCALL                                               'version_compare'
         13        FETCH_DIM_R                                      ~6      !0, 1
         14        SEND_VAL                                                 ~6
         15        FETCH_DIM_R                                      ~7      !1, 1
         16        SEND_VAL                                                 ~7
         17        DO_ICALL                                         $8      
         18      > RETURN                                                   $8
    7    19*     > RETURN                                                   null

End of function csort

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.01 ms | 1396 KiB | 21 Q