3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $priv; private static function set(self $instance, $name, $value) { $instance->$name = $value; } public function __construct(self $instance = null) { if ($instance) { self::set($instance, 'priv', 'dafuq'); } } } $a = new Foo; $b = new Foo($a); var_dump($a, $b);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vNhaN
function name:  (null)
number of ops:  12
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   21     3        NEW                                              $5      'Foo'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !1, $5
   23     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Class Foo:
Function set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vNhaN
function name:  set
number of ops:  6
compiled vars:  !0 = $instance, !1 = $name, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    9     3        ASSIGN_OBJ                                               !0, !1
          4        OP_DATA                                                  !2
   10     5      > RETURN                                                   null

End of function set

Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 7
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/vNhaN
function name:  __construct
number of ops:  8
compiled vars:  !0 = $instance
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV_INIT                                        !0      null
   14     1      > JMPZ                                                     !0, ->7
   15     2    >   INIT_STATIC_METHOD_CALL                                  'set'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'priv'
          5        SEND_VAL                                                 'dafuq'
          6        DO_FCALL                                      0          
   17     7    > > RETURN                                                   null

End of function __construct

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.18 ms | 1396 KiB | 15 Q