3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Box{ protected $type, $ref; function __construct($type, &$var){ $this->type = $type; $this->ref = &$var; } function __set($name, $data){ $this->ref = [$this->type, "__box"]($data); } } function §($type, &$var){ return new Box($type, $var); } // --------- class UString{ function __construct($data){ $this->data = $data; } static function __box($data){ if(is_string($data)) return new static($data); throw new Error; } } const UString = UString::CLASS; // --------- §(UString, $bar)->set = "ùnìcòdè"; var_dump($bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TIjI8
function name:  (null)
number of ops:  13
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   DECLARE_CONST                                            'UString', 'UString'
   33     1        INIT_FCALL                                               '%C2%A7'
          2        FETCH_CONSTANT                                   ~1      'UString'
          3        SEND_VAL                                                 ~1
          4        SEND_REF                                                 !0
          5        DO_FCALL                                      0  $2      
          6        SEPARATE                                         $2      $2
          7        ASSIGN_OBJ                                               $2, 'set'
          8        OP_DATA                                                  '%C3%B9n%C3%ACc%C3%B2d%C3%A8'
   34     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function %C2%A7:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TIjI8
function name:  §
number of ops:  8
compiled vars:  !0 = $type, !1 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   15     2        NEW                                              $2      'Box'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
          6      > RETURN                                                   $2
   16     7*     > RETURN                                                   null

End of function %C2%A7

Class Box:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TIjI8
function name:  __construct
number of ops:  7
compiled vars:  !0 = $type, !1 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        ASSIGN_OBJ                                               'type'
          3        OP_DATA                                                  !0
    7     4        ASSIGN_OBJ_REF                                           'ref'
          5        OP_DATA                                                  !1
    8     6      > RETURN                                                   null

End of function __construct

Function __set:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TIjI8
function name:  __set
number of ops:  11
compiled vars:  !0 = $name, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        FETCH_OBJ_R                                      ~3      'type'
          3        INIT_ARRAY                                       ~4      ~3
          4        ADD_ARRAY_ELEMENT                                ~4      '__box'
          5        INIT_DYNAMIC_CALL                                        ~4
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0  $5      
          8        ASSIGN_OBJ                                               'ref'
          9        OP_DATA                                                  $5
   11    10      > RETURN                                                   null

End of function __set

End of class Box.

Class UString:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TIjI8
function name:  __construct
number of ops:  4
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        ASSIGN_OBJ                                               'data'
          2        OP_DATA                                                  !0
   23     3      > RETURN                                                   null

End of function __construct

Function __box:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/TIjI8
function name:  __box
number of ops:  11
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
   25     1        TYPE_CHECK                                   64          !0
          2      > JMPZ                                                     ~1, ->7
   26     3    >   NEW                          static              $2      
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6      > RETURN                                                   $2
   27     7    >   NEW                                              $4      'Error'
          8        DO_FCALL                                      0          
          9      > THROW                                         0          $4
   28    10*     > RETURN                                                   null

End of function __box

End of class UString.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.33 ms | 1407 KiB | 16 Q