3v4l.org

run code in 300+ PHP versions simultaneously
<?php # THIS IS VERY SERIOUS :O # BY https://twitter.com/codelytv class_alias('Text', 'T'); class_alias('ListᐸTᐳ', 'ListᐸTextᐳ'); class Text { public $value; public function __construct(string $value) { $this->value = $value; } } class ListᐸTᐳ { public $elements; public function __construct(T ...$elements) { $this->elements = $elements; } } $listOfTexts = new ListᐸTextᐳ(new Text('first element'), new Text('second element')); var_dump($listOfTexts->elements);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rpXZW
function name:  (null)
number of ops:  24
compiled vars:  !0 = $listOfTexts
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   6     0  E >   INIT_FCALL                                               'class_alias'
         1        SEND_VAL                                                 'Text'
         2        SEND_VAL                                                 'T'
         3        DO_ICALL                                                 
   7     4        INIT_FCALL                                               'class_alias'
         5        SEND_VAL                                                 'List%E1%90%B8T%E1%90%B3'
         6        SEND_VAL                                                 'List%E1%90%B8Text%E1%90%B3'
         7        DO_ICALL                                                 
  21     8        NEW                                              $3      :33
         9        NEW                                              $4      :33
        10        SEND_VAL_EX                                              'first+element'
        11        DO_FCALL                                      0          
        12        SEND_VAR_NO_REF_EX                                       $4
        13        NEW                                              $6      :28
        14        SEND_VAL_EX                                              'second+element'
        15        DO_FCALL                                      0          
        16        SEND_VAR_NO_REF_EX                                       $6
        17        DO_FCALL                                      0          
        18        ASSIGN                                                   !0, $3
  23    19        INIT_FCALL                                               'var_dump'
        20        FETCH_OBJ_R                                      ~10     !0, 'elements'
        21        SEND_VAL                                                 ~10
        22        DO_ICALL                                                 
        23      > RETURN                                                   1

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

End of function __construct

End of class Text.

Class ListᐸTᐳ:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rpXZW
function name:  __construct
number of ops:  4
compiled vars:  !0 = $elements
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  15     0  E >   RECV_VARIADIC                                    !0      
  17     1        ASSIGN_OBJ                                               'elements'
         2        OP_DATA                                                  !0
  18     3      > RETURN                                                   null

End of function __construct

End of class ListᐸTᐳ.

Generated using Vulcan Logic Dumper, using php 7.4.0