3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Thing { public function __call($name, $params) { return 'foo'; } } function can_be_string($var) { return $var === null || is_scalar($var) || (is_object($var) && method_exists($var, '__toString')); } $a = new Thing; var_dump(can_be_string($a)); (string) $a;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uULab
function name:  (null)
number of ops:  12
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $1      'Thing'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   17     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'can_be_string'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   19     9        CAST                                          6  ~6      !0
         10        FREE                                                     ~6
         11      > RETURN                                                   1

Function can_be_string:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 47) Position 1 = 6, Position 2 = 14
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
Branch analysis from position: 14
Branch analysis from position: 5
filename:       /in/uULab
function name:  can_be_string
number of ops:  16
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        TYPE_CHECK                                    2  ~1      !0
          2      > JMPNZ_EX                                         ~1      ~1, ->5
          3    >   TYPE_CHECK                                  124  ~2      !0
          4        BOOL                                             ~1      ~2
          5    > > JMPNZ_EX                                         ~1      ~1, ->14
          6    >   TYPE_CHECK                                  256  ~3      !0
          7      > JMPZ_EX                                          ~3      ~3, ->13
          8    >   INIT_FCALL                                               'method_exists'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 '__toString'
         11        DO_ICALL                                         $4      
         12        BOOL                                             ~3      $4
         13    >   BOOL                                             ~1      ~3
         14    > > RETURN                                                   ~1
   13    15*     > RETURN                                                   null

End of function can_be_string

Class Thing:
Function __call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uULab
function name:  __call
number of ops:  4
compiled vars:  !0 = $name, !1 = $params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2      > RETURN                                                   'foo'
    8     3*     > RETURN                                                   null

End of function __call

End of class Thing.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.65 ms | 1435 KiB | 16 Q