3v4l.org

run code in 500+ PHP versions simultaneously
<?php const code = '2'; class X { private array $code = []; function foo() { return (string) $this<-code; } function __toString(){ return "1"; } } var_dump((new x)->foo());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cogKD
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CONST                                                'code', '2'
    7     1        DECLARE_CLASS                                                'x'
   19     2        INIT_FCALL                                                   'var_dump'
          3        NEW                                                  $0      'x'
          4        DO_FCALL                                          0          
          5        INIT_METHOD_CALL                                             $0, 'foo'
          6        DO_FCALL                                          0  $2      
          7        SEND_VAR                                                     $2
          8        DO_ICALL                                                     
          9      > RETURN                                                       1

Class X:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cogKD
function name:  foo
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   FETCH_THIS                                           ~0      
          1        CAST                                              6  ~1      ~0
          2        FETCH_CONSTANT                                       ~2      'code'
          3        MUL                                                  ~3      ~2, -1
          4        IS_SMALLER                                           ~4      ~1, ~3
          5      > RETURN                                                       ~4
   12     6*     > RETURN                                                       null

End of function foo

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