3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { private int $i = 1; public function __toString(): string { return (string)$this->i++; } } const CONSTANT = new A; class B { public const ClassConstant1 = '' . CONSTANT; public const ClassConstant2 = '' . CONSTANT; public const ClassConstant3 = '' . CONSTANT; public const ClassConstant4 = '' . CONSTANT; public const Constants = [ self::ClassConstant1, self::ClassConstant2, self::ClassConstant3, self::ClassConstant4, ]; } var_dump(B::ClassConstant4); var_dump(B::ClassConstant3); var_dump(B::ClassConstant2); var_dump(B::ClassConstant1); var_dump(B::Constants);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dWAaW
function name:  (null)
number of ops:  23
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'a'
   10     1        DECLARE_CONST                                                'CONSTANT', <const ast>
   26     2        INIT_FCALL                                                   'var_dump'
          3        FETCH_CLASS_CONSTANT                                 ~0      'B', 'ClassConstant4'
          4        SEND_VAL                                                     ~0
          5        DO_ICALL                                                     
   27     6        INIT_FCALL                                                   'var_dump'
          7        FETCH_CLASS_CONSTANT                                 ~2      'B', 'ClassConstant3'
          8        SEND_VAL                                                     ~2
          9        DO_ICALL                                                     
   28    10        INIT_FCALL                                                   'var_dump'
         11        FETCH_CLASS_CONSTANT                                 ~4      'B', 'ClassConstant2'
         12        SEND_VAL                                                     ~4
         13        DO_ICALL                                                     
   29    14        INIT_FCALL                                                   'var_dump'
         15        FETCH_CLASS_CONSTANT                                 ~6      'B', 'ClassConstant1'
         16        SEND_VAL                                                     ~6
         17        DO_ICALL                                                     
   31    18        INIT_FCALL                                                   'var_dump'
         19        FETCH_CLASS_CONSTANT                                 ~8      'B', 'Constants'
         20        SEND_VAL                                                     ~8
         21        DO_ICALL                                                     
         22      > RETURN                                                       1

Class A:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dWAaW
function name:  __toString
number of ops:  6
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   POST_INC_OBJ                                         ~0      'i'
          1        CAST                                              6  ~1      ~0
          2        VERIFY_RETURN_TYPE                                           ~1
          3      > RETURN                                                       ~1
    7     4*       VERIFY_RETURN_TYPE                                           
          5*     > RETURN                                                       null

End of function __tostring

End of class A.

Class B: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
155.94 ms | 1497 KiB | 14 Q