3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Coalescing { protected $attributes = [ 'attribute1' => 'value1', ]; public function __get($name) { print "GET\n"; if (array_key_exists($name, $this->attributes)) { return $this->attributes[$name]; } trigger_error("Property $name does not exist"); return null; } public function __isset($name) { print "ISSET\n"; return array_key_exists($name, $this->attributes); } } $coal = new Coalescing(); var_dump($coal->attribute1 ?? 'default'); //GET //string(6) "value1" var_dump($coal->attribute2 ?? 'default'); //GET //PHP Notice: Property attribute2 does not exist in /var/www/html/test.php on line 23 //PHP Stack trace: //PHP 1. {main}() /var/www/html/test.php:0 //PHP 2. Coalescing->__get() /var/www/html/test.php:41 //PHP 3. trigger_error() /var/www/html/test.php:23 ///var/www/html/test.php:41: //string(7) "default"
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HBQRr
function name:  (null)
number of ops:  16
compiled vars:  !0 = $coal
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E >   NEW                                                  $1      'Coalescing'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   30     3        INIT_FCALL                                                   'var_dump'
          4        FETCH_OBJ_IS                                         ~4      !0, 'attribute1'
          5        COALESCE                                             ~5      ~4
          6        QM_ASSIGN                                            ~5      'default'
          7        SEND_VAL                                                     ~5
          8        DO_ICALL                                                     
   34     9        INIT_FCALL                                                   'var_dump'
         10        FETCH_OBJ_IS                                         ~7      !0, 'attribute2'
         11        COALESCE                                             ~8      ~7
         12        QM_ASSIGN                                            ~8      'default'
         13        SEND_VAL                                                     ~8
         14        DO_ICALL                                                     
   42    15      > RETURN                                                       1

Class Coalescing:
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
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HBQRr
function name:  __get
number of ops:  16
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
   11     1        ECHO                                                         'GET%0A'
   12     2        FETCH_OBJ_R                                          ~1      'attributes'
          3        ARRAY_KEY_EXISTS                                             !0, ~1
          4      > JMPZ                                                         ~2, ->8
   13     5    >   FETCH_OBJ_R                                          ~3      'attributes'
          6        FETCH_DIM_R                                          ~4      ~3, !0
          7      > RETURN                                                       ~4
   16     8    >   INIT_FCALL                                                   'trigger_error'
          9        ROPE_INIT                                         3  ~6      'Property+'
         10        ROPE_ADD                                          1  ~6      ~6, !0
         11        ROPE_END                                          2  ~5      ~6, '+does+not+exist'
         12        SEND_VAL                                                     ~5
         13        DO_ICALL                                                     
   17    14      > RETURN                                                       null
   18    15*     > RETURN                                                       null

End of function __get

Function __isset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HBQRr
function name:  __isset
number of ops:  6
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   RECV                                                 !0      
   22     1        ECHO                                                         'ISSET%0A'
   23     2        FETCH_OBJ_R                                          ~1      'attributes'
          3        ARRAY_KEY_EXISTS                                     ~2      !0, ~1
          4      > RETURN                                                       ~2
   24     5*     > RETURN                                                       null

End of function __isset

End of class Coalescing.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.65 ms | 2281 KiB | 15 Q