3v4l.org

run code in 300+ PHP versions simultaneously
<?php class myClass { private $a; public function __construct() { $this->a = 10; } public function printValue() { print "The Value is: {$this->a}\n"; } public function changeValue($val, $obj = null) { if(is_null($obj)) { $this->a = $val; } else { $obj->a = $val; } } public function getValue() { return $this->a; } } $obj_one = new myClass(); $obj_two = new myClass(); $obj_two->a = 20; $obj_one->changeValue(20, $obj_two); $obj_two->changeValue($obj_two->getValue(), $obj_one); $obj_two->printValue(); $obj_one->printValue(); var_dump($obj_two);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tCWQd
function name:  (null)
number of ops:  26
compiled vars:  !0 = $obj_one, !1 = $obj_two
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   NEW                                              $2      'myClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   28     3        NEW                                              $5      'myClass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   30     6        ASSIGN_OBJ                                               !1, 'a'
          7        OP_DATA                                                  20
   31     8        INIT_METHOD_CALL                                         !0, 'changeValue'
          9        SEND_VAL_EX                                              20
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0          
   32    12        INIT_METHOD_CALL                                         !1, 'changeValue'
         13        INIT_METHOD_CALL                                         !1, 'getValue'
         14        DO_FCALL                                      0  $10     
         15        SEND_VAR_NO_REF_EX                                       $10
         16        SEND_VAR_EX                                              !0
         17        DO_FCALL                                      0          
   34    18        INIT_METHOD_CALL                                         !1, 'printValue'
         19        DO_FCALL                                      0          
   35    20        INIT_METHOD_CALL                                         !0, 'printValue'
         21        DO_FCALL                                      0          
   37    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !1
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Class myClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tCWQd
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN_OBJ                                               'a'
          1        OP_DATA                                                  10
    8     2      > RETURN                                                   null

End of function __construct

Function printvalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tCWQd
function name:  printValue
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ROPE_INIT                                     3  ~2      'The+Value+is%3A+'
          1        FETCH_OBJ_R                                      ~0      'a'
          2        ROPE_ADD                                      1  ~2      ~2, ~0
          3        ROPE_END                                      2  ~1      ~2, '%0A'
          4        ECHO                                                     ~1
   12     5      > RETURN                                                   null

End of function printvalue

Function changevalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tCWQd
function name:  changeValue
number of ops:  10
compiled vars:  !0 = $val, !1 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
   15     2        TYPE_CHECK                                    2          !1
          3      > JMPZ                                                     ~2, ->7
   16     4    >   ASSIGN_OBJ                                               'a'
          5        OP_DATA                                                  !0
          6      > JMP                                                      ->9
   18     7    >   ASSIGN_OBJ                                               !1, 'a'
          8        OP_DATA                                                  !0
   20     9    > > RETURN                                                   null

End of function changevalue

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

End of function getvalue

End of class myClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.57 ms | 1400 KiB | 15 Q