3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Primary { public function __toString() { $GLOBALS['anObject'] = $this; var_dump('toString called'); return 'toString output from Primary'; } } $Foo = new Primary; // no-op, execute __toString ''.$Foo; // expected to be object of class Primary, actually string var_dump($GLOBALS['anObject']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uuhpW
function name:  (null)
number of ops:  12
compiled vars:  !0 = $Foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'primary'
   10     1        NEW                                              $1      'Primary'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   13     4        CONCAT                                           ~4      '', !0
          5        FREE                                                     ~4
   16     6        INIT_FCALL                                               'var_dump'
          7        FETCH_R                      global              ~5      'GLOBALS'
          8        FETCH_DIM_R                                      ~6      ~5, 'anObject'
          9        SEND_VAL                                                 ~6
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Class Primary:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uuhpW
function name:  __toString
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   FETCH_THIS                                       ~2      
          1        FETCH_W                      global              $0      'GLOBALS'
          2        ASSIGN_DIM                                               $0, 'anObject'
          3        OP_DATA                                                  ~2
    5     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAL                                                 'toString+called'
          6        DO_ICALL                                                 
    6     7      > RETURN                                                   'toString+output+from+Primary'
    7     8*       VERIFY_RETURN_TYPE                                       
          9*     > RETURN                                                   null

End of function __tostring

End of class Primary.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.48 ms | 1395 KiB | 15 Q