3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { var $elements = array(); function Foo() { $stdObj = new stdClass; $stdObj->name = 'foo1'; $stdObj->active = false; $this->elements[] = $stdObj; } function getElementByName($name) { foreach($this->elements as $elm) { if ($elm->name == $name) { return $elm; } } } function test( ){ return $this->elements; } } $myFoo = new Foo(); $myFoo->getElementByName('foo1')->active = true; var_dump($myFoo->test());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6rtUp
function name:  (null)
number of ops:  15
compiled vars:  !0 = $myFoo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   29     3        INIT_METHOD_CALL                                         !0, 'getElementByName'
          4        SEND_VAL_EX                                              'foo1'
          5        DO_FCALL                                      0  $4      
          6        SEPARATE                                         $4      $4
          7        ASSIGN_OBJ                                               $4, 'active'
          8        OP_DATA                                                  <true>
   30     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !0, 'test'
         11        DO_FCALL                                      0  $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Class Foo:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6rtUp
function name:  Foo
number of ops:  11
compiled vars:  !0 = $stdObj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $1      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   11     3        ASSIGN_OBJ                                               !0, 'name'
          4        OP_DATA                                                  'foo1'
   12     5        ASSIGN_OBJ                                               !0, 'active'
          6        OP_DATA                                                  <false>
   14     7        FETCH_OBJ_W                                      $6      'elements'
          8        ASSIGN_DIM                                               $6
          9        OP_DATA                                                  !0
   15    10      > RETURN                                                   null

End of function foo

Function getelementbyname:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/6rtUp
function name:  getElementByName
number of ops:  12
compiled vars:  !0 = $name, !1 = $elm
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        FETCH_OBJ_R                                      ~2      'elements'
          2      > FE_RESET_R                                       $3      ~2, ->10
          3    > > FE_FETCH_R                                               $3, !1, ->10
   18     4    >   FETCH_OBJ_R                                      ~4      !1, 'name'
          5        IS_EQUAL                                                 !0, ~4
          6      > JMPZ                                                     ~5, ->9
   19     7    >   FE_FREE                                                  $3
          8      > RETURN                                                   !1
   17     9    > > JMP                                                      ->3
         10    >   FE_FREE                                                  $3
   22    11      > RETURN                                                   null

End of function getelementbyname

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

End of function test

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.18 ms | 1400 KiB | 15 Q