3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foobar { public function call($method, $parameters) { if (in_array($method, ['foo', 'bar'])) { return $this->$method($parameters); } $message = 'Hello world.'; return $this->$method($message, $parameters); } public function dump($message, $params) { echo $message . PHP_EOL; 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('foo', 'test', 'foobar');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MZuQj
function name:  (null)
number of ops:  10
compiled vars:  !0 = $foobar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $1      'Foobar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   35     3        INIT_METHOD_CALL                                         !0, 'call'
          4        SEND_VAL_EX                                              'foo'
          5        SEND_VAL_EX                                              'test'
          6        SEND_VAL_EX                                              'foobar'
          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/MZuQj
function name:  call
number of ops:  15
compiled vars:  !0 = $method, !1 = $parameters, !2 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        IN_ARRAY                                                 !0, <array>
          3      > JMPZ                                                     ~3, ->8
    9     4    >   INIT_METHOD_CALL                                         !0
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0  $4      
          7      > RETURN                                                   $4
   12     8    >   ASSIGN                                                   !2, 'Hello+world.'
   14     9        INIT_METHOD_CALL                                         !0
         10        SEND_VAR_EX                                              !2
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0  $6      
         13      > RETURN                                                   $6
   15    14*     > 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/MZuQj
function name:  dump
number of ops:  9
compiled vars:  !0 = $message, !1 = $params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        CONCAT                                           ~2      !0, '%0A'
          3        ECHO                                                     ~2
   20     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   21     8*     > 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/MZuQj
function name:  foo
number of ops:  8
compiled vars:  !0 = $params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV_VARIADIC                                    !0      
   25     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
   26     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/MZuQj
function name:  bar
number of ops:  8
compiled vars:  !0 = $params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV_VARIADIC                                    !0      
   30     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
   31     7*     > RETURN                                                   null

End of function bar

End of class Foobar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.15 ms | 1400 KiB | 17 Q