3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ToString { public function __toString() { return 'baz'; } } $handle = fopen("php://memory", "r"); var_dump((string) 5); var_dump((string) 1.5); var_dump((string) 'foo'); var_dump((string) null); var_dump((string) true); var_dump((string) false); var_dump((string) new ToString()); var_dumP((string) new \stdClass); var_dumP((string) $handle);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fNrUf
function name:  (null)
number of ops:  47
compiled vars:  !0 = $handle
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'tostring'
   10     1        INIT_FCALL                                               'fopen'
          2        SEND_VAL                                                 'php%3A%2F%2Fmemory'
          3        SEND_VAL                                                 'r'
          4        DO_ICALL                                         $1      
          5        ASSIGN                                                   !0, $1
   12     6        INIT_FCALL                                               'var_dump'
          7        CAST                                          6  ~3      5
          8        SEND_VAL                                                 ~3
          9        DO_ICALL                                                 
   13    10        INIT_FCALL                                               'var_dump'
         11        CAST                                          6  ~5      1.5
         12        SEND_VAL                                                 ~5
         13        DO_ICALL                                                 
   14    14        INIT_FCALL                                               'var_dump'
         15        CAST                                          6  ~7      'foo'
         16        SEND_VAL                                                 ~7
         17        DO_ICALL                                                 
   15    18        INIT_FCALL                                               'var_dump'
         19        CAST                                          6  ~9      null
         20        SEND_VAL                                                 ~9
         21        DO_ICALL                                                 
   16    22        INIT_FCALL                                               'var_dump'
         23        CAST                                          6  ~11     <true>
         24        SEND_VAL                                                 ~11
         25        DO_ICALL                                                 
   17    26        INIT_FCALL                                               'var_dump'
         27        CAST                                          6  ~13     <false>
         28        SEND_VAL                                                 ~13
         29        DO_ICALL                                                 
   18    30        INIT_FCALL                                               'var_dump'
         31        NEW                                              $15     'ToString'
         32        DO_FCALL                                      0          
         33        CAST                                          6  ~17     $15
         34        SEND_VAL                                                 ~17
         35        DO_ICALL                                                 
   19    36        INIT_FCALL                                               'var_dump'
         37        NEW                                              $19     'stdClass'
         38        DO_FCALL                                      0          
         39        CAST                                          6  ~21     $19
         40        SEND_VAL                                                 ~21
         41        DO_ICALL                                                 
   20    42        INIT_FCALL                                               'var_dump'
         43        CAST                                          6  ~23     !0
         44        SEND_VAL                                                 ~23
         45        DO_ICALL                                                 
         46      > RETURN                                                   1

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

End of function __tostring

End of class ToString.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.72 ms | 1400 KiB | 17 Q