3v4l.org

run code in 500+ PHP versions simultaneously
<?php function which_is_lower($a, $b) { if ( $a < $b ) { return $a; } else { return $b; } } function compare_comparisons($a, $b) { echo 'min() gives: '; var_dump( min($a, $b) ); echo 'comparison with < gives: '; var_dump( which_is_lower($a, $b) ); } echo "\n", '-1 vs NULL: ', "\n"; compare_comparisons(-1, NULL); echo "\n", '1 vs NULL: ', "\n"; compare_comparisons(1, NULL); echo "\n", '-1 vs FALSE: ', "\n"; compare_comparisons(-1, FALSE); echo "\n", '1 vs FALSE: ', "\n"; compare_comparisons(1, FALSE); echo "\n", '-1 vs TRUE: ', "\n"; compare_comparisons(-1, TRUE); echo "\n", '1 vs TRUE: ', "\n"; compare_comparisons(1, TRUE);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7HGVI
function name:  (null)
number of ops:  43
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   ECHO                                                         '%0A'
          1        ECHO                                                         '-1+vs+NULL%3A+'
          2        ECHO                                                         '%0A'
   24     3        INIT_FCALL                                                   'compare_comparisons'
          4        SEND_VAL                                                     -1
          5        SEND_VAL                                                     null
          6        DO_FCALL                                          0          
   26     7        ECHO                                                         '%0A'
          8        ECHO                                                         '1+vs+NULL%3A+'
          9        ECHO                                                         '%0A'
   27    10        INIT_FCALL                                                   'compare_comparisons'
         11        SEND_VAL                                                     1
         12        SEND_VAL                                                     null
         13        DO_FCALL                                          0          
   29    14        ECHO                                                         '%0A'
         15        ECHO                                                         '-1+vs+FALSE%3A+'
         16        ECHO                                                         '%0A'
   30    17        INIT_FCALL                                                   'compare_comparisons'
         18        SEND_VAL                                                     -1
         19        SEND_VAL                                                     <false>
         20        DO_FCALL                                          0          
   32    21        ECHO                                                         '%0A'
         22        ECHO                                                         '1+vs+FALSE%3A+'
         23        ECHO                                                         '%0A'
   33    24        INIT_FCALL                                                   'compare_comparisons'
         25        SEND_VAL                                                     1
         26        SEND_VAL                                                     <false>
         27        DO_FCALL                                          0          
   35    28        ECHO                                                         '%0A'
         29        ECHO                                                         '-1+vs+TRUE%3A+'
         30        ECHO                                                         '%0A'
   36    31        INIT_FCALL                                                   'compare_comparisons'
         32        SEND_VAL                                                     -1
         33        SEND_VAL                                                     <true>
         34        DO_FCALL                                          0          
   38    35        ECHO                                                         '%0A'
         36        ECHO                                                         '1+vs+TRUE%3A+'
         37        ECHO                                                         '%0A'
   39    38        INIT_FCALL                                                   'compare_comparisons'
         39        SEND_VAL                                                     1
         40        SEND_VAL                                                     <true>
         41        DO_FCALL                                          0          
         42      > RETURN                                                       1

Function which_is_lower:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7HGVI
function name:  which_is_lower
number of ops:  8
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    5     2        IS_SMALLER                                                   !0, !1
          3      > JMPZ                                                         ~2, ->6
    7     4    > > RETURN                                                       !0
    5     5*       JMP                                                          ->7
   11     6    > > RETURN                                                       !1
   13     7*     > RETURN                                                       null

End of function which_is_lower

Function compare_comparisons:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7HGVI
function name:  compare_comparisons
number of ops:  16
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   17     2        ECHO                                                         'min%28%29+gives%3A+'
   18     3        INIT_FCALL                                                   'var_dump'
          4        FRAMELESS_ICALL_2                min                 ~2      !0, !1
          5        SEND_VAL                                                     ~2
          6        DO_ICALL                                                     
   19     7        ECHO                                                         'comparison+with+%3C+gives%3A+'
   20     8        INIT_FCALL                                                   'var_dump'
          9        INIT_FCALL                                                   'which_is_lower'
         10        SEND_VAR                                                     !0
         11        SEND_VAR                                                     !1
         12        DO_FCALL                                          0  $4      
         13        SEND_VAR                                                     $4
         14        DO_ICALL                                                     
   21    15      > RETURN                                                       null

End of function compare_comparisons

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
129.2 ms | 485 KiB | 15 Q