3v4l.org

run code in 500+ PHP versions simultaneously
<?php new class { private array $data = ['foo' => true, 'bar' => false,]; function __construct() { // $this->foo ||= true; $this->foo || ($this->foo = true); assert($this->data['foo'] === true); // $this->bar ||= false; $this->bar || ($this->bar = false); assert($this->data['bar'] === false); } function __get(string $name): bool { echo "Getter called for {$name}\n"; return $this->data[$name]; } function __set(string $name, bool $value): void { echo "Setter called for {$name}\n"; $this->data[$name] = $value; } };
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LJp09
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_ANON_CLASS                                   <true>  
          1        NEW                                                  $1      $0
          2        DO_FCALL                                          0          
          3        FREE                                                         $1
   26     4      > RETURN                                                       1

Class class@anonymous:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 2, Position 2 = 5
Branch analysis from position: 2
2 jumps found. (Code = 47) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 5
filename:       /in/LJp09
function name:  __construct
number of ops:  27
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_R                                          ~0      'foo'
          1      > JMPNZ_EX                                             ~0      ~0, ->5
          2    >   ASSIGN_OBJ                                           ~1      'foo'
          3        OP_DATA                                                      <true>
          4        BOOL                                                 ~0      ~1
   10     5    >   ASSERT_CHECK                                                 
          6        INIT_FCALL                                                   'assert'
          7        FETCH_OBJ_R                                          ~2      'data'
          8        FETCH_DIM_R                                          ~3      ~2, 'foo'
          9        TYPE_CHECK                                        8  ~4      ~3
         10        SEND_VAL                                                     ~4
         11        SEND_VAL                                                     'assert%28%24this-%3Edata%5B%27foo%27%5D+%3D%3D%3D+true%29'
         12        DO_ICALL                                                     
   13    13        FETCH_OBJ_R                                          ~6      'bar'
         14      > JMPNZ_EX                                             ~6      ~6, ->18
         15    >   ASSIGN_OBJ                                           ~7      'bar'
         16        OP_DATA                                                      <false>
         17        BOOL                                                 ~6      ~7
   14    18    >   ASSERT_CHECK                                                 
         19        INIT_FCALL                                                   'assert'
         20        FETCH_OBJ_R                                          ~8      'data'
         21        FETCH_DIM_R                                          ~9      ~8, 'bar'
         22        TYPE_CHECK                                        4  ~10     ~9
         23        SEND_VAL                                                     ~10
         24        SEND_VAL                                                     'assert%28%24this-%3Edata%5B%27bar%27%5D+%3D%3D%3D+false%29'
         25        DO_ICALL                                                     
   15    26      > RETURN                                                       null

End of function __construct

Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LJp09
function name:  __get
number of ops:  11
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   RECV                                                 !0      
   18     1        ROPE_INIT                                         3  ~2      'Getter+called+for+'
          2        ROPE_ADD                                          1  ~2      ~2, !0
          3        ROPE_END                                          2  ~1      ~2, '%0A'
          4        ECHO                                                         ~1
   19     5        FETCH_OBJ_R                                          ~4      'data'
          6        FETCH_DIM_R                                          ~5      ~4, !0
          7        VERIFY_RETURN_TYPE                                           ~5
          8      > RETURN                                                       ~5
   20     9*       VERIFY_RETURN_TYPE                                           
         10*     > RETURN                                                       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/LJp09
function name:  __set
number of ops:  10
compiled vars:  !0 = $name, !1 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   23     2        ROPE_INIT                                         3  ~3      'Setter+called+for+'
          3        ROPE_ADD                                          1  ~3      ~3, !0
          4        ROPE_END                                          2  ~2      ~3, '%0A'
          5        ECHO                                                         ~2
   24     6        FETCH_OBJ_W                                          $5      'data'
          7        ASSIGN_DIM                                                   $5, !0
          8        OP_DATA                                                      !1
   25     9      > RETURN                                                       null

End of function __set

End of class class@anonymous.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
127.11 ms | 482 KiB | 8 Q