3v4l.org

run code in 500+ PHP versions simultaneously
<?php class StringableClass{ public function __toString() { return __CLASS__; } } $obj = new StringableClass(); $str = (string)$obj; echo "cast: $str\n"; $str = settype($obj, 'string'); echo "settype: $str\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8gDuV
function name:  (null)
number of ops:  20
compiled vars:  !0 = $obj, !1 = $str
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                                'stringableclass'
    9     1        NEW                                                  $2      'StringableClass'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $2
   11     4        CAST                                              6  ~5      !0
          5        ASSIGN                                                       !1, ~5
   12     6        ROPE_INIT                                         3  ~8      'cast%3A+'
          7        ROPE_ADD                                          1  ~8      ~8, !1
          8        ROPE_END                                          2  ~7      ~8, '%0A'
          9        ECHO                                                         ~7
   14    10        INIT_FCALL                                                   'settype'
         11        SEND_REF                                                     !0
         12        SEND_VAL                                                     'string'
         13        DO_ICALL                                             $10     
         14        ASSIGN                                                       !1, $10
   15    15        ROPE_INIT                                         3  ~13     'settype%3A+'
         16        ROPE_ADD                                          1  ~13     ~13, !1
         17        ROPE_END                                          2  ~12     ~13, '%0A'
         18        ECHO                                                         ~12
         19      > RETURN                                                       1

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

End of function __tostring

End of class StringableClass.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
116.06 ms | 486 KiB | 10 Q