3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A implements Stringable { private $value = 'a'; public function __toString() { return $this->value; } } $a = new A(); var_dump($a, (string) $a, is_string($a), $a instanceof Stringable);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KRfCO
function name:  (null)
number of ops:  14
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'a'
   11     1        NEW                                              $1      'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   13     4        INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !0
          6        CAST                                          6  ~4      !0
          7        SEND_VAL                                                 ~4
          8        TYPE_CHECK                                   64  ~5      !0
          9        SEND_VAL                                                 ~5
         10        INSTANCEOF                                       ~6      !0, 'Stringable'
         11        SEND_VAL                                                 ~6
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class A:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KRfCO
function name:  __toString
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_OBJ_R                                      ~0      'value'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
    8     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function __tostring

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.7 ms | 1395 KiB | 15 Q