3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a{ public function __toString() { $debug = debug_backtrace(); echo "__toString called on line ".$debug['0']['line']."\n"; return ""; } } function string_param(string $a){ } function object_param(object $a){ echo $a; //here (string)$a; //here $a == "0"; //here string_param($a); //here ?><?= $a; ?><?php //here } $a = new a(); $a == "0"; //here string_param($a); //here object_param($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F4qIL
function name:  (null)
number of ops:  13
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'a'
   23     1        NEW                                              $1      'a'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   24     4        IS_EQUAL                                         ~4      !0, '0'
          5        FREE                                                     ~4
   25     6        INIT_FCALL                                               'string_param'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0          
   26     9        INIT_FCALL                                               'object_param'
         10        SEND_VAR                                                 !0
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

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

End of function string_param

Function object_param:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F4qIL
function name:  object_param
number of ops:  11
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   16     1        ECHO                                                     !0
   17     2        CAST                                          6  ~1      !0
          3        FREE                                                     ~1
   18     4        IS_EQUAL                                         ~2      !0, '0'
          5        FREE                                                     ~2
   19     6        INIT_FCALL                                               'string_param'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0          
   20     9        ECHO                                                     !0
   21    10      > RETURN                                                   null

End of function object_param

Class a:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F4qIL
function name:  __toString
number of ops:  11
compiled vars:  !0 = $debug
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'debug_backtrace'
          1        DO_ICALL                                         $1      
          2        ASSIGN                                                   !0, $1
    6     3        FETCH_DIM_R                                      ~3      !0, 0
          4        FETCH_DIM_R                                      ~4      ~3, 'line'
          5        CONCAT                                           ~5      '__toString+called+on+line+', ~4
          6        CONCAT                                           ~6      ~5, '%0A'
          7        ECHO                                                     ~6
    7     8      > RETURN                                                   ''
    8     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function __tostring

End of class a.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
298.81 ms | 1095 KiB | 17 Q