3v4l.org

run code in 500+ PHP versions simultaneously
<?php class User { public string $first_name; public string $last_name; /** * this is going to be a lazy property, uninitialized by default, perhaps writting like: * * lazy public string $full_name; */ public string $full_name; function __construct() { // this is what the "lazy" type would do in the background.. keep the public property uninitialized until set otherwise handled by __get/__set unset($this->full_name); } function __get($key) { if ($key === 'full_name') { return $this->first_name.' '.$this->last_name; } } } $user = new User(); $user->first_name = 'John'; $user->last_name = 'Wick'; echo $user->full_name;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fQ4AG
function name:  (null)
number of ops:  10
compiled vars:  !0 = $user
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   NEW                                              $1      'User'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   30     3        ASSIGN_OBJ                                               !0, 'first_name'
          4        OP_DATA                                                  'John'
   31     5        ASSIGN_OBJ                                               !0, 'last_name'
          6        OP_DATA                                                  'Wick'
   33     7        FETCH_OBJ_R                                      ~6      !0, 'full_name'
          8        ECHO                                                     ~6
   34     9      > RETURN                                                   1

Class User:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fQ4AG
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   UNSET_OBJ                                                'full_name'
   19     1      > RETURN                                                   null

End of function __construct

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fQ4AG
function name:  __get
number of ops:  9
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        IS_IDENTICAL                                             !0, 'full_name'
          2      > JMPZ                                                     ~1, ->8
   23     3    >   FETCH_OBJ_R                                      ~2      'first_name'
          4        CONCAT                                           ~3      ~2, '+'
          5        FETCH_OBJ_R                                      ~4      'last_name'
          6        CONCAT                                           ~5      ~3, ~4
          7      > RETURN                                                   ~5
   25     8    > > RETURN                                                   null

End of function __get

End of class User.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
191.56 ms | 1455 KiB | 13 Q