3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Content { protected array $data = array('sequence'=>1); public function &__get(string $property) : mixed { if(isset($this->data[$property]) === false): $this->data[$property] = null; endif; return $this->data[$property]; } public function __set(string $name,mixed $value) : void { $this->data[$name] = $value; } } final class MyClass { private object $content; public function __construct(){ $this->content = new Content(); } public function generateSequence() : int { $result = $this->content->sequence * 2 + 1; $this->content->sequence += 1; return $result; } } $myclass = new MyClass(); print $myclass->generateSequence();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L7GIR
function name:  (null)
number of ops:  7
compiled vars:  !0 = $myclass
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $1      'MyClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   29     3        INIT_METHOD_CALL                                         !0, 'generateSequence'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
          6      > RETURN                                                   1

Class Content:
Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
Return found
Branch analysis from position: 8
filename:       /in/L7GIR
function name:  __get
number of ops:  13
compiled vars:  !0 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        FETCH_OBJ_IS                                     ~1      'data'
          2        ISSET_ISEMPTY_DIM_OBJ                         0  ~2      ~1, !0
          3        TYPE_CHECK                                    4          ~2
          4      > JMPZ                                                     ~3, ->8
    8     5    >   FETCH_OBJ_W                                      $4      'data'
          6        ASSIGN_DIM                                               $4, !0
          7        OP_DATA                                                  null
   10     8    >   FETCH_OBJ_W                                      $6      'data'
          9        FETCH_DIM_W                                      $7      $6, !0
         10      > RETURN_BY_REF                                            $7
   11    11*       VERIFY_RETURN_TYPE                                       
         12*     > RETURN_BY_REF                                            null

End of function __get

Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L7GIR
function name:  __set
number of ops:  6
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        FETCH_OBJ_W                                      $2      'data'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   14     5      > RETURN                                                   null

End of function __set

End of class Content.

Class MyClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L7GIR
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $1      'Content'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'content'
          3        OP_DATA                                                  $1
   21     4      > RETURN                                                   null

End of function __construct

Function generatesequence:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L7GIR
function name:  generateSequence
number of ops:  12
compiled vars:  !0 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   FETCH_OBJ_R                                      ~1      'content'
          1        FETCH_OBJ_R                                      ~2      ~1, 'sequence'
          2        MUL                                              ~3      ~2, 2
          3        ADD                                              ~4      ~3, 1
          4        ASSIGN                                                   !0, ~4
   24     5        FETCH_OBJ_RW                                     $6      'content'
          6        ASSIGN_OBJ_OP                                 1          $6, 'sequence'
          7        OP_DATA                                                  1
   25     8        VERIFY_RETURN_TYPE                                       !0
          9      > RETURN                                                   !0
   26    10*       VERIFY_RETURN_TYPE                                       
         11*     > RETURN                                                   null

End of function generatesequence

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.3 ms | 1447 KiB | 13 Q