3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $id; } class Foo2 { public $id; public function __construct($id) { $this->id = $id; } } class Foo3 { protected $id; public function __construct($id) { $this->id = $id; } public function getId() { return $this->id; } } class Foo4 { private $id; public function __construct($id) { $this->id = $id; } public function __get($key) { echo $key; return $this->id; } } $data = new Foo; $data->id = 10; echo $data->id; $data2 = new Foo2(10); echo $data2->id; $data3 = new Foo3(10); echo $data3->getId(); $data4 = new Foo4(10); echo $data4->id;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Te4YC
function name:  (null)
number of ops:  27
compiled vars:  !0 = $data, !1 = $data2, !2 = $data3, !3 = $data4
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   NEW                                              $4      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   37     3        ASSIGN_OBJ                                               !0, 'id'
          4        OP_DATA                                                  10
   38     5        FETCH_OBJ_R                                      ~8      !0, 'id'
          6        ECHO                                                     ~8
   40     7        NEW                                              $9      'Foo2'
          8        SEND_VAL_EX                                              10
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $9
   41    11        FETCH_OBJ_R                                      ~12     !1, 'id'
         12        ECHO                                                     ~12
   43    13        NEW                                              $13     'Foo3'
         14        SEND_VAL_EX                                              10
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !2, $13
   44    17        INIT_METHOD_CALL                                         !2, 'getId'
         18        DO_FCALL                                      0  $16     
         19        ECHO                                                     $16
   45    20        NEW                                              $17     'Foo4'
         21        SEND_VAL_EX                                              10
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !3, $17
   46    24        FETCH_OBJ_R                                      ~20     !3, 'id'
         25        ECHO                                                     ~20
         26      > RETURN                                                   1

Class Foo: [no user functions]
Class Foo2:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Te4YC
function name:  __construct
number of ops:  4
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        ASSIGN_OBJ                                               'id'
          2        OP_DATA                                                  !0
   11     3      > RETURN                                                   null

End of function __construct

End of class Foo2.

Class Foo3:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Te4YC
function name:  __construct
number of ops:  4
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        ASSIGN_OBJ                                               'id'
          2        OP_DATA                                                  !0
   18     3      > RETURN                                                   null

End of function __construct

Function getid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Te4YC
function name:  getId
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   FETCH_OBJ_R                                      ~0      'id'
          1      > RETURN                                                   ~0
   22     2*     > RETURN                                                   null

End of function getid

End of class Foo3.

Class Foo4:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Te4YC
function name:  __construct
number of ops:  4
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
   28     1        ASSIGN_OBJ                                               'id'
          2        OP_DATA                                                  !0
   29     3      > RETURN                                                   null

End of function __construct

Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Te4YC
function name:  __get
number of ops:  5
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
   32     1        ECHO                                                     !0
   33     2        FETCH_OBJ_R                                      ~1      'id'
          3      > RETURN                                                   ~1
   34     4*     > RETURN                                                   null

End of function __get

End of class Foo4.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.46 ms | 1399 KiB | 13 Q