3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Controller { function foo() { echo phpversion(); } } $controller = new Controller(); if (version_compare(phpversion(), '7', '>=')) { echo 'test'; $callable = call_user_func($controller, 'foo'); } else { $callable = [$controller, 'foo']; } $callable();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GHu07
function name:  (null)
number of ops:  23
compiled vars:  !0 = $controller, !1 = $callable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   NEW                                              $2      'Controller'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   11     3        INIT_FCALL                                               'version_compare'
          4        INIT_FCALL                                               'phpversion'
          5        DO_ICALL                                         $5      
          6        SEND_VAR                                                 $5
          7        SEND_VAL                                                 '7'
          8        SEND_VAL                                                 '%3E%3D'
          9        DO_ICALL                                         $6      
         10      > JMPZ                                                     $6, ->17
   12    11    >   ECHO                                                     'test'
   13    12        INIT_USER_CALL                                1          'call_user_func', !0
         13        SEND_USER                                                'foo'
         14        DO_FCALL                                      0  $7      
         15        ASSIGN                                                   !1, $7
         16      > JMP                                                      ->20
   15    17    >   INIT_ARRAY                                       ~9      !0
         18        ADD_ARRAY_ELEMENT                                ~9      'foo'
         19        ASSIGN                                                   !1, ~9
   18    20    >   INIT_DYNAMIC_CALL                                        !1
         21        DO_FCALL                                      0          
         22      > RETURN                                                   1

Class Controller:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GHu07
function name:  foo
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'phpversion'
          1        DO_ICALL                                         $0      
          2        ECHO                                                     $0
    7     3      > RETURN                                                   null

End of function foo

End of class Controller.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.57 ms | 1396 KiB | 17 Q