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 { exit; $obj->a = $val; } } public function getValue() { return $this->a; } } $obj_one = new myClass(); $obj_two = new myClass(); $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/n33YX
function name:  (null)
number of ops:  24
compiled vars:  !0 = $obj_one, !1 = $obj_two
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $2      'myClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   29     3        NEW                                              $5      'myClass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   31     6        INIT_METHOD_CALL                                         !0, 'changeValue'
          7        SEND_VAL_EX                                              20
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
   32    10        INIT_METHOD_CALL                                         !1, 'changeValue'
         11        INIT_METHOD_CALL                                         !1, 'getValue'
         12        DO_FCALL                                      0  $9      
         13        SEND_VAR_NO_REF_EX                                       $9
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0          
   34    16        INIT_METHOD_CALL                                         !1, 'printValue'
         17        DO_FCALL                                      0          
   35    18        INIT_METHOD_CALL                                         !0, 'printValue'
         19        DO_FCALL                                      0          
   37    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Class myClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n33YX
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/n33YX
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 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/n33YX
function name:  changeValue
number of ops:  11
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                                                      ->10
   18     7    > > EXIT                                                     
   19     8*       ASSIGN_OBJ                                               !1, 'a'
          9*       OP_DATA                                                  !0
   21    10    > > 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/n33YX
function name:  getValue
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   FETCH_OBJ_R                                      ~0      'a'
          1      > RETURN                                                   ~0
   25     2*     > RETURN                                                   null

End of function getvalue

End of class myClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.04 ms | 1400 KiB | 15 Q