3v4l.org

run code in 500+ PHP versions simultaneously
<?php $xml = new SimpleXMLElement('<tag></tag>'); echo 'An empty SimpleXMLElement is '; var_export((bool) $xml); echo "\n"; $xml = new SimpleXMLElement('<tag>data</tag>'); echo 'A SimpleXMLElement with data is '; var_export((bool) $xml); echo "\n"; $obj = new stdClass(); echo 'An empty stdClass is '; var_export((bool) $obj); echo "\n"; class A { public function __toString() { return ''; } } $a = new A(); echo 'A class that returns an empty string from __toString() is '; var_export((bool) $a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4Xk4v
function name:  (null)
number of ops:  39
compiled vars:  !0 = $xml, !1 = $obj, !2 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   NEW                                                  $3      'SimpleXMLElement'
          1        SEND_VAL_EX                                                  '%3Ctag%3E%3C%2Ftag%3E'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $3
    3     4        ECHO                                                         'An+empty+SimpleXMLElement+is+'
    4     5        INIT_FCALL                                                   'var_export'
          6        BOOL                                                 ~6      !0
          7        SEND_VAL                                                     ~6
          8        DO_ICALL                                                     
    5     9        ECHO                                                         '%0A'
    7    10        NEW                                                  $8      'SimpleXMLElement'
         11        SEND_VAL_EX                                                  '%3Ctag%3Edata%3C%2Ftag%3E'
         12        DO_FCALL                                          0          
         13        ASSIGN                                                       !0, $8
    8    14        ECHO                                                         'A+SimpleXMLElement+with+data+is+'
    9    15        INIT_FCALL                                                   'var_export'
         16        BOOL                                                 ~11     !0
         17        SEND_VAL                                                     ~11
         18        DO_ICALL                                                     
   10    19        ECHO                                                         '%0A'
   12    20        NEW                                                  $13     'stdClass'
         21        DO_FCALL                                          0          
         22        ASSIGN                                                       !1, $13
   13    23        ECHO                                                         'An+empty+stdClass+is+'
   14    24        INIT_FCALL                                                   'var_export'
         25        BOOL                                                 ~16     !1
         26        SEND_VAL                                                     ~16
         27        DO_ICALL                                                     
   15    28        ECHO                                                         '%0A'
   17    29        DECLARE_CLASS                                                'a'
   22    30        NEW                                                  $18     'A'
         31        DO_FCALL                                          0          
         32        ASSIGN                                                       !2, $18
   23    33        ECHO                                                         'A+class+that+returns+an+empty+string+from+__toString%28%29+is+'
   24    34        INIT_FCALL                                                   'var_export'
         35        BOOL                                                 ~21     !2
         36        SEND_VAL                                                     ~21
         37        DO_ICALL                                                     
         38      > RETURN                                                       1

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

End of function __tostring

End of class A.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.42 ms | 3418 KiB | 14 Q