3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Cl { public function __get($n) { if ($n === 'test') { return null; } return $this->$n; // default fallback } public function __isset($n) { if ($n === 'test') { return true; // __isset() is the only way to return if property exists, returning true for null value violates isset() definition } return $this->$n; // default fallback } } $cl = new Cl(); var_dump($cl->test); var_dump(isset($cl->test));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GqUsh
function name:  (null)
number of ops:  12
compiled vars:  !0 = $cl
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'Cl'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   22     3        INIT_FCALL                                               'var_dump'
          4        FETCH_OBJ_R                                      ~4      !0, 'test'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                                 
   23     7        INIT_FCALL                                               'var_dump'
          8        ISSET_ISEMPTY_PROP_OBJ                           ~6      !0, 'test'
          9        SEND_VAL                                                 ~6
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Class Cl:
Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GqUsh
function name:  __get
number of ops:  7
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        IS_IDENTICAL                                             !0, 'test'
          2      > JMPZ                                                     ~1, ->4
    6     3    > > RETURN                                                   null
    9     4    >   FETCH_OBJ_R                                      ~2      !0
          5      > RETURN                                                   ~2
   10     6*     > RETURN                                                   null

End of function __get

Function __isset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GqUsh
function name:  __isset
number of ops:  7
compiled vars:  !0 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        IS_IDENTICAL                                             !0, 'test'
          2      > JMPZ                                                     ~1, ->4
   14     3    > > RETURN                                                   <true>
   17     4    >   FETCH_OBJ_R                                      ~2      !0
          5      > RETURN                                                   ~2
   18     6*     > RETURN                                                   null

End of function __isset

End of class Cl.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.64 ms | 1396 KiB | 15 Q