3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Source https://bugs.php.net/bug.php?id=62328 class UberSimpleXML extends SimpleXMLElement { public function __toString() { return 'stringification'; } } $xml = new UberSimpleXML('<xml/>'); $xml->tag = "stuff"; echo "\nno cast: ". $xml; echo "\ncast: ". (string)$xml; echo "\nexplicit call:". $xml->__toString(); 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/lrMQ1
function name:  (null)
number of ops:  26
compiled vars:  !0 = $xml
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'ubersimplexml', 'simplexmlelement'
   10     1        NEW                                              $1      'UberSimpleXML'
          2        SEND_VAL_EX                                              '%3Cxml%2F%3E'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   11     5        ASSIGN_OBJ                                               !0, 'tag'
          6        OP_DATA                                                  'stuff'
   13     7        CONCAT                                           ~5      '%0Ano+cast%3A+', !0
          8        ECHO                                                     ~5
   14     9        CAST                                          6  ~6      !0
         10        CONCAT                                           ~7      '%0Acast%3A+', ~6
         11        ECHO                                                     ~7
   15    12        INIT_METHOD_CALL                                         !0, '__toString'
         13        DO_FCALL                                      0  $8      
         14        CONCAT                                           ~9      '%0Aexplicit+call%3A', $8
         15        ECHO                                                     ~9
   17    16        INIT_FCALL                                               'var_dump'
         17        CAST                                          6  ~10     !0
         18        SEND_VAL                                                 ~10
         19        DO_ICALL                                                 
   18    20        INIT_FCALL                                               'var_dump'
         21        INIT_METHOD_CALL                                         !0, '__toString'
         22        DO_FCALL                                      0  $12     
         23        SEND_VAR                                                 $12
         24        DO_ICALL                                                 
         25      > RETURN                                                   1

Class UberSimpleXML:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lrMQ1
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E > > RETURN                                                   'stringification'
    7     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:
159.15 ms | 1396 KiB | 15 Q