3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public function __set($name, $value) { echo "__set($name)\n"; return $this->bar($name, $value); } public function bar($name, $value) { echo "bar($name)\n"; $this->foo = $value; } } echo "Calling via accessor:\n"; $foo = new Foo; $foo->foo = 42; echo "Calling method directly:\n"; $foo = new Foo; $foo->bar('foo', 42);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dpYOj
function name:  (null)
number of ops:  15
compiled vars:  !0 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   ECHO                                                         'Calling+via+accessor%3A%0A'
   16     1        NEW                                                  $1      'Foo'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   17     4        ASSIGN_OBJ                                                   !0, 'foo'
          5        OP_DATA                                                      42
   19     6        ECHO                                                         'Calling+method+directly%3A%0A'
   20     7        NEW                                                  $5      'Foo'
          8        DO_FCALL                                          0          
          9        ASSIGN                                                       !0, $5
   21    10        INIT_METHOD_CALL                                             !0, 'bar'
         11        SEND_VAL_EX                                                  'foo'
         12        SEND_VAL_EX                                                  42
         13        DO_FCALL                                          0          
         14      > RETURN                                                       1

Class Foo:
Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dpYOj
function name:  __set
number of ops:  12
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    5     2        ROPE_INIT                                         3  ~3      '__set%28'
          3        ROPE_ADD                                          1  ~3      ~3, !0
          4        ROPE_END                                          2  ~2      ~3, '%29%0A'
          5        ECHO                                                         ~2
    6     6        INIT_METHOD_CALL                                             'bar'
          7        SEND_VAR_EX                                                  !0
          8        SEND_VAR_EX                                                  !1
          9        DO_FCALL                                          0  $5      
         10      > RETURN                                                       $5
    7    11*     > RETURN                                                       null

End of function __set

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dpYOj
function name:  bar
number of ops:  9
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   10     2        ROPE_INIT                                         3  ~3      'bar%28'
          3        ROPE_ADD                                          1  ~3      ~3, !0
          4        ROPE_END                                          2  ~2      ~3, '%29%0A'
          5        ECHO                                                         ~2
   11     6        ASSIGN_OBJ                                                   'foo'
          7        OP_DATA                                                      !1
   12     8      > RETURN                                                       null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
175.21 ms | 1676 KiB | 13 Q