3v4l.org

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

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/FESZd
function name:  call
number of ops:  13
compiled vars:  !0 = $method, !1 = $parameters
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV_INIT                                        !0      'dump'
          1        RECV                                             !1      
    7     2        IN_ARRAY                                                 !0, <array>
          3      > JMPZ                                                     ~2, ->8
    9     4    >   INIT_METHOD_CALL                                         !0
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0  $3      
          7      > RETURN                                                   $3
   12     8    >   INIT_METHOD_CALL                                         !0
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $4      
         11      > RETURN                                                   $4
   13    12*     > RETURN                                                   null

End of function call

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

End of function dump

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FESZd
function name:  foo
number of ops:  8
compiled vars:  !0 = $params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV_VARIADIC                                    !0      
   22     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
   23     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/FESZd
function name:  bar
number of ops:  8
compiled vars:  !0 = $params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV_VARIADIC                                    !0      
   27     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
   28     7*     > RETURN                                                   null

End of function bar

End of class Foobar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.76 ms | 1400 KiB | 17 Q