3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Controller { function foo() { echo phpversion(); } } $controller = new Controller(); if (version_compare(phpversion(), '7', '>=')) { $callable = call_user_func_array([get_class($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 = 20
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/msjVg
function name:  (null)
number of ops:  26
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, ->20
   12    11    >   GET_CLASS                                        ~7      !0
         12        INIT_ARRAY                                       ~8      ~7
         13        ADD_ARRAY_ELEMENT                                ~8      'foo'
         14        INIT_USER_CALL                                0          'call_user_func_array', ~8
         15        SEND_ARRAY                                               <array>
         16        CHECK_UNDEF_ARGS                                         
         17        DO_FCALL                                      0  $9      
         18        ASSIGN                                                   !1, $9
         19      > JMP                                                      ->23
   14    20    >   INIT_ARRAY                                       ~11     !0
         21        ADD_ARRAY_ELEMENT                                ~11     'foo'
         22        ASSIGN                                                   !1, ~11
   17    23    >   INIT_DYNAMIC_CALL                                        !1
         24        DO_FCALL                                      0          
         25      > RETURN                                                   1

Class Controller:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/msjVg
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.4 ms | 1396 KiB | 17 Q