3v4l.org

run code in 300+ PHP versions simultaneously
<?php Class World { public $greeting; public $rand; // no value private $priv; public function __construct() { $this->greeting = 'Hello'; } } $w = new World(); $wr = (array) $w; list($greet_exists, $greet_isset_o, $greet_isset_a, $greet_a_e,$greet_empty) = [ json_encode(property_exists($w,'greeting')), json_encode(isset($w->greeting)), json_encode(isset($wr['greeting'])), json_encode(array_key_exists('greeting', $wr)), json_encode(empty($w->greeting)) ]; echo "Greeting: {$wr['greeting']}; Exists: $greet_exists; Is prop set: $greet_isset_o; Is index set: $greet_isset_a; Array index: $greet_a_e; Empty: $greet_empty".PHP_EOL; list($rand_exists,$rand_isset_o,$rand_isset_a,$rand_a_e,$rand_empty) = [ json_encode(property_exists($w,'rand')),json_encode(isset($w->rand)), json_encode(isset($wr['rand'])),json_encode(array_key_exists('rand', $wr)), json_encode(empty($w->rand)) ]; echo "Random: {$wr['rand']}; Exists: $rand_exists; Is prop set: $rand_isset_o; Is index set: $rand_isset_a; Array index: $rand_a_e; Empty: $rand_empty".PHP_EOL; list($priv_exists,$priv_isset_o,$priv_isset_a,$priv_a_e,$priv_empty) = [ json_encode(property_exists($w,'priv')),json_encode(isset($w->priv)), json_encode(isset($wr['priv'])),json_encode(array_key_exists('priv', $wr)), json_encode(empty($w->priv)) ]; echo "Private: {$wr['priv']}; Exists: $priv_exists; Is prop set: $priv_isset_o; Is index set: $priv_isset_a; Array index: $priv_a_e; Empty: $priv_empty".PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1hLkj
function name:  (null)
number of ops:  168
compiled vars:  !0 = $w, !1 = $wr, !2 = $greet_exists, !3 = $greet_isset_o, !4 = $greet_isset_a, !5 = $greet_a_e, !6 = $greet_empty, !7 = $rand_exists, !8 = $rand_isset_o, !9 = $rand_isset_a, !10 = $rand_a_e, !11 = $rand_empty, !12 = $priv_exists, !13 = $priv_isset_o, !14 = $priv_isset_a, !15 = $priv_a_e, !16 = $priv_empty
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $17     'World'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $17
   12     3        CAST                                          7  ~20     !0
          4        ASSIGN                                                   !1, ~20
   15     5        INIT_FCALL                                               'json_encode'
          6        INIT_FCALL                                               'property_exists'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 'greeting'
          9        DO_ICALL                                         $22     
         10        SEND_VAR                                                 $22
         11        DO_ICALL                                         $23     
         12        INIT_ARRAY                                       ~24     $23
         13        INIT_FCALL                                               'json_encode'
         14        ISSET_ISEMPTY_PROP_OBJ                           ~25     !0, 'greeting'
         15        SEND_VAL                                                 ~25
         16        DO_ICALL                                         $26     
         17        ADD_ARRAY_ELEMENT                                ~24     $26
   16    18        INIT_FCALL                                               'json_encode'
         19        ISSET_ISEMPTY_DIM_OBJ                         0  ~27     !1, 'greeting'
         20        SEND_VAL                                                 ~27
         21        DO_ICALL                                         $28     
         22        ADD_ARRAY_ELEMENT                                ~24     $28
         23        INIT_FCALL                                               'json_encode'
         24        ARRAY_KEY_EXISTS                                 ~29     'greeting', !1
         25        SEND_VAL                                                 ~29
         26        DO_ICALL                                         $30     
         27        ADD_ARRAY_ELEMENT                                ~24     $30
         28        INIT_FCALL                                               'json_encode'
         29        ISSET_ISEMPTY_PROP_OBJ                           ~31     !0, 'greeting'
         30        SEND_VAL                                                 ~31
         31        DO_ICALL                                         $32     
         32        ADD_ARRAY_ELEMENT                                ~24     $32
         33        FETCH_LIST_R                                     $33     ~24, 0
   14    34        ASSIGN                                                   !2, $33
         35        FETCH_LIST_R                                     $35     ~24, 1
         36        ASSIGN                                                   !3, $35
         37        FETCH_LIST_R                                     $37     ~24, 2
         38        ASSIGN                                                   !4, $37
         39        FETCH_LIST_R                                     $39     ~24, 3
         40        ASSIGN                                                   !5, $39
         41        FETCH_LIST_R                                     $41     ~24, 4
         42        ASSIGN                                                   !6, $41
         43        FREE                                                     ~24
   19    44        ROPE_INIT                                    12  ~45     'Greeting%3A+'
         45        FETCH_DIM_R                                      ~43     !1, 'greeting'
         46        ROPE_ADD                                      1  ~45     ~45, ~43
         47        ROPE_ADD                                      2  ~45     ~45, '%3B+Exists%3A+'
         48        ROPE_ADD                                      3  ~45     ~45, !2
         49        ROPE_ADD                                      4  ~45     ~45, '%3B+Is+prop+set%3A+'
         50        ROPE_ADD                                      5  ~45     ~45, !3
         51        ROPE_ADD                                      6  ~45     ~45, '%3B+Is+index+set%3A+'
         52        ROPE_ADD                                      7  ~45     ~45, !4
         53        ROPE_ADD                                      8  ~45     ~45, '%3B+Array+index%3A+'
         54        ROPE_ADD                                      9  ~45     ~45, !5
         55        ROPE_ADD                                     10  ~45     ~45, '%3B+Empty%3A+'
         56        ROPE_END                                     11  ~44     ~45, !6
         57        CONCAT                                           ~51     ~44, '%0A'
         58        ECHO                                                     ~51
   22    59        INIT_FCALL                                               'json_encode'
         60        INIT_FCALL                                               'property_exists'
         61        SEND_VAR                                                 !0
         62        SEND_VAL                                                 'rand'
         63        DO_ICALL                                         $52     
         64        SEND_VAR                                                 $52
         65        DO_ICALL                                         $53     
         66        INIT_ARRAY                                       ~54     $53
         67        INIT_FCALL                                               'json_encode'
         68        ISSET_ISEMPTY_PROP_OBJ                           ~55     !0, 'rand'
         69        SEND_VAL                                                 ~55
         70        DO_ICALL                                         $56     
         71        ADD_ARRAY_ELEMENT                                ~54     $56
   23    72        INIT_FCALL                                               'json_encode'
         73        ISSET_ISEMPTY_DIM_OBJ                         0  ~57     !1, 'rand'
         74        SEND_VAL                                                 ~57
         75        DO_ICALL                                         $58     
         76        ADD_ARRAY_ELEMENT                                ~54     $58
         77        INIT_FCALL                                               'json_encode'
         78        ARRAY_KEY_EXISTS                                 ~59     'rand', !1
         79        SEND_VAL                                                 ~59
         80        DO_ICALL                                         $60     
         81        ADD_ARRAY_ELEMENT                                ~54     $60
         82        INIT_FCALL                                               'json_encode'
         83        ISSET_ISEMPTY_PROP_OBJ                           ~61     !0, 'rand'
         84        SEND_VAL                                                 ~61
         85        DO_ICALL                                         $62     
         86        ADD_ARRAY_ELEMENT                                ~54     $62
         87        FETCH_LIST_R                                     $63     ~54, 0
   21    88        ASSIGN                                                   !7, $63
         89        FETCH_LIST_R                                     $65     ~54, 1
         90        ASSIGN                                                   !8, $65
         91        FETCH_LIST_R                                     $67     ~54, 2
         92        ASSIGN                                                   !9, $67
         93        FETCH_LIST_R                                     $69     ~54, 3
         94        ASSIGN                                                   !10, $69
         95        FETCH_LIST_R                                     $71     ~54, 4
         96        ASSIGN                                                   !11, $71
         97        FREE                                                     ~54
   25    98        ROPE_INIT                                    12  ~75     'Random%3A+'
         99        FETCH_DIM_R                                      ~73     !1, 'rand'
        100        ROPE_ADD                                      1  ~75     ~75, ~73
        101        ROPE_ADD                                      2  ~75     ~75, '%3B+Exists%3A+'
        102        ROPE_ADD                                      3  ~75     ~75, !7
        103        ROPE_ADD                                      4  ~75     ~75, '%3B+Is+prop+set%3A+'
        104        ROPE_ADD                                      5  ~75     ~75, !8
        105        ROPE_ADD                                      6  ~75     ~75, '%3B+Is+index+set%3A+'
        106        ROPE_ADD                                      7  ~75     ~75, !9
        107        ROPE_ADD                                      8  ~75     ~75, '%3B+Array+index%3A+'
        108        ROPE_ADD                                      9  ~75     ~75, !10
        109        ROPE_ADD                                     10  ~75     ~75, '%3B+Empty%3A+'
        110        ROPE_END                                     11  ~74     ~75, !11
        111        CONCAT                                           ~81     ~74, '%0A'
        112        ECHO                                                     ~81
   28   113        INIT_FCALL                                               'json_encode'
        114        INIT_FCALL                                               'property_exists'
        115        SEND_VAR                                                 !0
        116        SEND_VAL                                                 'priv'
        117        DO_ICALL                                         $82     
        118        SEND_VAR                                                 $82
        119        DO_ICALL                                         $83     
        120        INIT_ARRAY                                       ~84     $83
        121        INIT_FCALL                                               'json_encode'
        122        ISSET_ISEMPTY_PROP_OBJ                           ~85     !0, 'priv'
        123        SEND_VAL                                                 ~85
        124        DO_ICALL                                         $86     
        125        ADD_ARRAY_ELEMENT                                ~84     $86
   29   126        INIT_FCALL                                               'json_encode'
        127        ISSET_ISEMPTY_DIM_OBJ                         0  ~87     !1, 'priv'
        128        SEND_VAL                                                 ~87
        129        DO_ICALL                                         $88     
        130        ADD_ARRAY_ELEMENT                                ~84     $88
        131        INIT_FCALL                                               'json_encode'
        132        ARRAY_KEY_EXISTS                                 ~89     'priv', !1
        133        SEND_VAL                                                 ~89
        134        DO_ICALL                                         $90     
        135        ADD_ARRAY_ELEMENT                                ~84     $90
        136        INIT_FCALL                                               'json_encode'
        137        ISSET_ISEMPTY_PROP_OBJ                           ~91     !0, 'priv'
        138        SEND_VAL                                                 ~91
        139        DO_ICALL                                         $92     
        140        ADD_ARRAY_ELEMENT                                ~84     $92
        141        FETCH_LIST_R                                     $93     ~84, 0
   27   142        ASSIGN                                                   !12, $93
        143        FETCH_LIST_R                                     $95     ~84, 1
        144        ASSIGN                                                   !13, $95
        145        FETCH_LIST_R                                     $97     ~84, 2
        146        ASSIGN                                                   !14, $97
        147        FETCH_LIST_R                                     $99     ~84, 3
        148        ASSIGN                                                   !15, $99
        149        FETCH_LIST_R                                     $101    ~84, 4
        150        ASSIGN                                                   !16, $101
        151        FREE                                                     ~84
   31   152        ROPE_INIT                                    12  ~105    'Private%3A+'
        153        FETCH_DIM_R                                      ~103    !1, 'priv'
        154        ROPE_ADD                                      1  ~105    ~105, ~103
        155        ROPE_ADD                                      2  ~105    ~105, '%3B+Exists%3A+'
        156        ROPE_ADD                                      3  ~105    ~105, !12
        157        ROPE_ADD                                      4  ~105    ~105, '%3B+Is+prop+set%3A+'
        158        ROPE_ADD                                      5  ~105    ~105, !13
        159        ROPE_ADD                                      6  ~105    ~105, '%3B+Is+index+set%3A+'
        160        ROPE_ADD                                      7  ~105    ~105, !14
        161        ROPE_ADD                                      8  ~105    ~105, '%3B+Array+index%3A+'
        162        ROPE_ADD                                      9  ~105    ~105, !15
        163        ROPE_ADD                                     10  ~105    ~105, '%3B+Empty%3A+'
        164        ROPE_END                                     11  ~104    ~105, !16
        165        CONCAT                                           ~111    ~104, '%0A'
        166        ECHO                                                     ~111
   32   167      > RETURN                                                   1

Class World:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1hLkj
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN_OBJ                                               'greeting'
          1        OP_DATA                                                  'Hello'
    9     2      > RETURN                                                   null

End of function __construct

End of class World.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.49 ms | 1408 KiB | 17 Q