3v4l.org

run code in 300+ PHP versions simultaneously
<?php class UberSimpleXML extends SimpleXMLElement { public function __toString() { return 'stringification'; } } $xml = new UberSimpleXML('<xml/>'); $xml->tag = "you're it!"; echo "\nno cast\n"; echo $xml; echo "\ncast\n"; echo (string) $xml; echo "\nexplicit call\n"; echo $xml->__toString(); echo "\n"; var_dump((string) $xml); var_dump($xml->__toString());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ClBPj
function name:  (null)
number of ops:  27
compiled vars:  !0 = $xml
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'ubersimplexml', 'simplexmlelement'
    8     1        NEW                                              $1      'UberSimpleXML'
          2        SEND_VAL_EX                                              '%3Cxml%2F%3E'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
    9     5        ASSIGN_OBJ                                               !0, 'tag'
          6        OP_DATA                                                  'you%27re+it%21'
   11     7        ECHO                                                     '%0Ano+cast%0A'
   12     8        ECHO                                                     !0
   13     9        ECHO                                                     '%0Acast%0A'
   14    10        CAST                                          6  ~5      !0
         11        ECHO                                                     ~5
   15    12        ECHO                                                     '%0Aexplicit+call%0A'
   16    13        INIT_METHOD_CALL                                         !0, '__toString'
         14        DO_FCALL                                      0  $6      
         15        ECHO                                                     $6
   17    16        ECHO                                                     '%0A'
   18    17        INIT_FCALL                                               'var_dump'
         18        CAST                                          6  ~7      !0
         19        SEND_VAL                                                 ~7
         20        DO_ICALL                                                 
   19    21        INIT_FCALL                                               'var_dump'
         22        INIT_METHOD_CALL                                         !0, '__toString'
         23        DO_FCALL                                      0  $9      
         24        SEND_VAR                                                 $9
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

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

End of function __tostring

End of class UberSimpleXML.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.15 ms | 1396 KiB | 15 Q