3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Token { public function __toString() { return 'token'; } } class Site { public function __toString() { return '1'; } } $test = [ strval(new Site) => new Token ]; var_dump($test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j8AdZ
function name:  (null)
number of ops:  13
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'token'
   11     1        DECLARE_CLASS                                            'site'
   20     2        NEW                                              $1      'Site'
          3        DO_FCALL                                      0          
          4        CAST                                          6  ~3      $1
          5        NEW                                              $4      'Token'
          6        DO_FCALL                                      0          
          7        INIT_ARRAY                                       ~6      $4, ~3
   19     8        ASSIGN                                                   !0, ~6
   23     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

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

End of function __tostring

End of class Token.

Class Site:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j8AdZ
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E > > RETURN                                                   '1'
   16     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function __tostring

End of class Site.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.49 ms | 1395 KiB | 15 Q