3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types = 1); class x { function __toString() : string { return "abc"; } } $x = new x; print $x . " and $x\n"; print $x; echo $x; echo PHP_EOL; print implode(', ', [$x, $x]); print implode($x, [1, 2]); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R6XVR
function name:  (null)
number of ops:  19
compiled vars:  !0 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'x'
    9     1        NEW                                                  $1      'x'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   10     4        ROPE_INIT                                         3  ~5      '+and+'
          5        ROPE_ADD                                          1  ~5      ~5, !0
          6        ROPE_END                                          2  ~4      ~5, '%0A'
          7        CONCAT                                               ~7      !0, ~4
          8        ECHO                                                         ~7
   12     9        ECHO                                                         !0
   13    10        ECHO                                                         !0
   14    11        ECHO                                                         '%0A'
   16    12        INIT_ARRAY                                           ~8      !0
         13        ADD_ARRAY_ELEMENT                                    ~8      !0
         14        FRAMELESS_ICALL_2                implode             ~9      '%2C+', ~8
         15        ECHO                                                         ~9
   17    16        FRAMELESS_ICALL_2                implode             ~10     !0, <array>
         17        ECHO                                                         ~10
   19    18      > RETURN                                                       1

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

End of function __tostring

End of class x.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.08 ms | 1641 KiB | 13 Q