3v4l.org

run code in 300+ PHP versions simultaneously
<?php class test { public function __get($var) { return true; // Different error return false; // Error return null; // Error return 0; // Different error return 1; // Different error return new StdClass(); // Different error } } // Different error is: Cannot use scalar value as an array // Using new StdClass it isn't scalar, but object $t = new test(); $t->arr[0] = 1; // Error $t->arr[0]; // No error $t->a; // No error $t->a = 1; // No error
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mHKrK
function name:  (null)
number of ops:  14
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        FETCH_OBJ_W                                      $4      !0, 'arr'
          4        ASSIGN_DIM                                               $4, 0
          5        OP_DATA                                                  1
   20     6        FETCH_OBJ_R                                      ~6      !0, 'arr'
          7        FETCH_DIM_R                                      ~7      ~6, 0
          8        FREE                                                     ~7
   21     9        FETCH_OBJ_R                                      ~8      !0, 'a'
         10        FREE                                                     ~8
   22    11        ASSIGN_OBJ                                               !0, 'a'
         12        OP_DATA                                                  1
         13      > RETURN                                                   1

Class test:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mHKrK
function name:  __get
number of ops:  10
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1      > RETURN                                                   <true>
    6     2*       RETURN                                                   <false>
    7     3*       RETURN                                                   null
    8     4*       RETURN                                                   0
    9     5*       RETURN                                                   1
   10     6*       NEW                                              $1      'StdClass'
          7*       DO_FCALL                                      0          
          8*       RETURN                                                   $1
   11     9*     > RETURN                                                   null

End of function __get

End of class test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.92 ms | 1394 KiB | 13 Q