3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { public function __toString() { static $i = 0; return (string) $i++; } } function test(string $foo = new Foo()) { var_dump($foo); } test(); test(); test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3SU3D
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'foo'
   14     1        INIT_FCALL                                                   'test'
          2        DO_FCALL                                          0          
   15     3        INIT_FCALL                                                   'test'
          4        DO_FCALL                                          0          
   16     5        INIT_FCALL                                                   'test'
          6        DO_FCALL                                          0          
          7      > RETURN                                                       1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3SU3D
function name:  test
number of ops:  5
compiled vars:  !0 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV_INIT                                            !0      <const ast>
   11     1        INIT_FCALL                                                   'var_dump'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                                     
   12     4      > RETURN                                                       null

End of function test

Class Foo:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3SU3D
function name:  __toString
number of ops:  7
compiled vars:  !0 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   BIND_STATIC                                                  !0
    6     1        POST_INC                                             ~1      !0
          2        CAST                                              6  ~2      ~1
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
    7     5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function __tostring

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.63 ms | 1644 KiB | 17 Q