3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); class x { function __toString() : string { return "YES"; } } function foo(string $a) {} // piece of syntax of the day (POSOTD) echo $x = new x; print " A $x"; // Fata error: Argument #1 ($a) must be of type string, x given, foo($x); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RAMIo
function name:  (null)
number of ops:  9
compiled vars:  !0 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                                'x'
   14     1        NEW                                                  $1      'x'
          2        DO_FCALL                                          0          
          3        ASSIGN                                               ~3      !0, $1
          4        ECHO                                                         ~3
   16     5        NOP                                                          
          6        FAST_CONCAT                                          ~4      '+A+', !0
          7        ECHO                                                         ~4
   20     8      > RETURN                                                       1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RAMIo
function name:  foo
number of ops:  2
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
          1      > RETURN                                                       null

End of function foo

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