3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Dumper { public function dump($args) { return var_dump($args); } } class Foobar { public function call($method, ...$parameters) { if (in_array($method, ['foo', 'bar'])) { return $this->$method($parameters); } $dumper = new Dumper; return $dumper->$method($parameters); } public function foo(...$params) { return 'foo ' . in_array('foobar', $params); } public function bar(...$params) { return 'bar ' . in_array('barfoo', $params); } } $foobar = new Foobar; echo $foobar->call('dump', 'test', 'foobar');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MfmD3
function name:  (null)
number of ops:  10
compiled vars:  !0 = $foobar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   NEW                                              $1      'Foobar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   33     3        INIT_METHOD_CALL                                         !0, 'call'
          4        SEND_VAL_EX                                              'dump'
          5        SEND_VAL_EX                                              'test'
          6        SEND_VAL_EX                                              'foobar'
          7        DO_FCALL                                      0  $4      
          8        ECHO                                                     $4
          9      > RETURN                                                   1

Class Dumper:
Function dump:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MfmD3
function name:  dump
number of ops:  6
compiled vars:  !0 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
          5*     > RETURN                                                   null

End of function dump

End of class Dumper.

Class Foobar:
Function call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MfmD3
function name:  call
number of ops:  16
compiled vars:  !0 = $method, !1 = $parameters, !2 = $dumper
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV_VARIADIC                                    !1      
   11     2        IN_ARRAY                                                 !0, <array>
          3      > JMPZ                                                     ~3, ->8
   13     4    >   INIT_METHOD_CALL                                         !0
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0  $4      
          7      > RETURN                                                   $4
   16     8    >   NEW                                              $5      'Dumper'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $5
   18    11        INIT_METHOD_CALL                                         !2, !0
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0  $8      
         14      > RETURN                                                   $8
   19    15*     > RETURN                                                   null

End of function call

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MfmD3
function name:  foo
number of ops:  8
compiled vars:  !0 = $params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV_VARIADIC                                    !0      
   23     1        INIT_FCALL                                               'in_array'
          2        SEND_VAL                                                 'foobar'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        CONCAT                                           ~2      'foo+', $1
          6      > RETURN                                                   ~2
   24     7*     > RETURN                                                   null

End of function foo

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MfmD3
function name:  bar
number of ops:  8
compiled vars:  !0 = $params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV_VARIADIC                                    !0      
   28     1        INIT_FCALL                                               'in_array'
          2        SEND_VAL                                                 'barfoo'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        CONCAT                                           ~2      'bar+', $1
          6      > RETURN                                                   ~2
   29     7*     > RETURN                                                   null

End of function bar

End of class Foobar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.95 ms | 1400 KiB | 17 Q