3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { function bar($x) { $that = $this; $powerOfThree = function($x) use ($that) { return $that->square($x) * $x; }; return $powerOfThree($x); } public function square($x) { return $x * $x; } } $foo = new Foo(); var_dump($foo->bar(2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LGY0d
function name:  (null)
number of ops:  10
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   20     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'bar'
          5        SEND_VAL_EX                                              2
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FLGY0d%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LGY0d
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $x, !1 = $that
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
    8     2        INIT_METHOD_CALL                                         !1, 'square'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        MUL                                              ~3      !0, $2
          6      > RETURN                                                   ~3
    9     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FLGY0d%3A7%240

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LGY0d
function name:  bar
number of ops:  11
compiled vars:  !0 = $x, !1 = $that, !2 = $powerOfThree
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    6     1        FETCH_THIS                                       ~3      
          2        ASSIGN                                                   !1, ~3
    7     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLGY0d%3A7%240'
          4        BIND_LEXICAL                                             ~5, !1
          5        ASSIGN                                                   !2, ~5
   11     6        INIT_DYNAMIC_CALL                                        !2
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $7      
          9      > RETURN                                                   $7
   12    10*     > RETURN                                                   null

End of function bar

Function square:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LGY0d
function name:  square
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        MUL                                              ~1      !0, !0
          2      > RETURN                                                   ~1
   16     3*     > RETURN                                                   null

End of function square

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.42 ms | 1400 KiB | 15 Q