3v4l.org

run code in 300+ PHP versions simultaneously
<?php class B { public function __toString() { return "Instances of B() can be treated as a strings!\n"; } } $b = new B(); print($b); //Instances of B() can be treated as a strings! print(is_string($b) ? 'true' : 'false'); //false
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R1kJr
function name:  (null)
number of ops:  12
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'b'
    8     1        NEW                                              $1      'B'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
    9     4        ECHO                                                     !0
   10     5        TYPE_CHECK                                   64          !0
          6      > JMPZ                                                     ~4, ->9
          7    >   QM_ASSIGN                                        ~5      'true'
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~5      'false'
         10    >   ECHO                                                     ~5
         11      > RETURN                                                   1

Class B:
Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R1kJr
function name:  __toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E > > RETURN                                                   'Instances+of+B%28%29+can+be+treated+as+a+strings%21%0A'
    5     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function __tostring

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.76 ms | 1394 KiB | 13 Q