3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array('abc 1.0','abc 1.1.1','abc 1.1','xyz 1.1','def 2.0'); function fct($a, $b) { list($al, $an) = explode(' ', $a); list($bl, $bn) = explode(' ', $b); if ( $al == $bl ) return version_compare($an, $bn); return strcmp($al, $bl); } usort($array, 'version_compare'); print_r($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RU1Jg
function name:  (null)
number of ops:  9
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   11     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'version_compare'
          4        DO_ICALL                                                 
   12     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

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

End of function fct

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.64 ms | 1392 KiB | 23 Q