3v4l.org

run code in 300+ PHP versions simultaneously
<?php my_version_compare("2.5.1", "2.5.2"); # => -1 (smaller) my_version_compare("2.5.2", "2.5.2"); # => 0 (equal) my_version_compare("2.5.5", "2.5.2"); # => 1 (bigger) my_version_compare("2.5.11", "2.5.2"); # => 1 (bigger, eleven is bigger than two) my_version_compare("2.5.0", "2.5"); # => 1 (bigger, eleven is bigger than two) function my_version_compare($version1, $version2) { echo 'strnatcmp: ', var_dump(strnatcmp($version1, $version2)); echo 'version_compare: ', var_dump(version_compare($version1, $version2)), "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ESa82
function name:  (null)
number of ops:  21
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL_BY_NAME                                       'my_version_compare'
          1        SEND_VAL_EX                                              '2.5.1'
          2        SEND_VAL_EX                                              '2.5.2'
          3        DO_FCALL                                      0          
    4     4        INIT_FCALL_BY_NAME                                       'my_version_compare'
          5        SEND_VAL_EX                                              '2.5.2'
          6        SEND_VAL_EX                                              '2.5.2'
          7        DO_FCALL                                      0          
    5     8        INIT_FCALL_BY_NAME                                       'my_version_compare'
          9        SEND_VAL_EX                                              '2.5.5'
         10        SEND_VAL_EX                                              '2.5.2'
         11        DO_FCALL                                      0          
    6    12        INIT_FCALL_BY_NAME                                       'my_version_compare'
         13        SEND_VAL_EX                                              '2.5.11'
         14        SEND_VAL_EX                                              '2.5.2'
         15        DO_FCALL                                      0          
    7    16        INIT_FCALL_BY_NAME                                       'my_version_compare'
         17        SEND_VAL_EX                                              '2.5.0'
         18        SEND_VAL_EX                                              '2.5'
         19        DO_FCALL                                      0          
   12    20      > RETURN                                                   1

Function my_version_compare:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ESa82
function name:  my_version_compare
number of ops:  22
compiled vars:  !0 = $version1, !1 = $version2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        ECHO                                                     'strnatcmp%3A+++++++'
          3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'strnatcmp'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                         $3      
         10        ECHO                                                     $3
   11    11        ECHO                                                     'version_compare%3A+'
         12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'version_compare'
         14        SEND_VAR                                                 !0
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $4      
         17        SEND_VAR                                                 $4
         18        DO_ICALL                                         $5      
         19        ECHO                                                     $5
         20        ECHO                                                     '%0A'
   12    21      > RETURN                                                   null

End of function my_version_compare

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.68 ms | 1400 KiB | 19 Q