3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * http://www.php.net/manual/en/language.variables.scope.php */ class ClassWithPropertiesThatHaveTheSameName { private $name = 'something'; // here they are the same, but differentiated public function setName($name) { $this->name = $name; } /** * @returns String|Other */ public function getName() { return $this->name; } /** * @returns Array|Transversable */ public function getAndTestLocalVariableNameArray() { $name = array('value' => $this->name); return $name; } } $same = new ClassWithPropertiesThatHaveTheSameName(); $same->setName('oranges and pecans in a tea from a tree'); echo $same->getName() . "\n\n"; print_r($same->getAndTestLocalVariableNameArray()); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MZ24v
function name:  (null)
number of ops:  16
compiled vars:  !0 = $same
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $1      'ClassWithPropertiesThatHaveTheSameName'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   35     3        INIT_METHOD_CALL                                         !0, 'setName'
          4        SEND_VAL_EX                                              'oranges+and+pecans+in+a+tea+from+a+tree'
          5        DO_FCALL                                      0          
   36     6        INIT_METHOD_CALL                                         !0, 'getName'
          7        DO_FCALL                                      0  $5      
          8        CONCAT                                           ~6      $5, '%0A%0A'
          9        ECHO                                                     ~6
   37    10        INIT_FCALL                                               'print_r'
         11        INIT_METHOD_CALL                                         !0, 'getAndTestLocalVariableNameArray'
         12        DO_FCALL                                      0  $7      
         13        SEND_VAR                                                 $7
         14        DO_ICALL                                                 
   39    15      > RETURN                                                   1

Class ClassWithPropertiesThatHaveTheSameName:
Function setname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MZ24v
function name:  setName
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
   14     3      > RETURN                                                   null

End of function setname

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

End of function getname

Function getandtestlocalvariablenamearray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MZ24v
function name:  getAndTestLocalVariableNameArray
number of ops:  5
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   FETCH_OBJ_R                                      ~1      'name'
          1        INIT_ARRAY                                       ~2      ~1, 'value'
          2        ASSIGN                                                   !0, ~2
   30     3      > RETURN                                                   !0
   31     4*     > RETURN                                                   null

End of function getandtestlocalvariablenamearray

End of class ClassWithPropertiesThatHaveTheSameName.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.48 ms | 1400 KiB | 15 Q