3v4l.org

run code in 300+ PHP versions simultaneously
<?php class StringCastable { private $data; public function __constructor($data) { $this->data = $data; } public function __toString() { return $this->toString(); } public function toString() { return $this->data; } } function testStringCast(string $data) { var_dump($data, get_class($data)); } testStringCast(new StringCastable("speculoos"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GI3Y7
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'stringcastable'
   28     1        INIT_FCALL                                               'teststringcast'
          2        NEW                                              $0      'StringCastable'
          3        SEND_VAL_EX                                              'speculoos'
          4        DO_FCALL                                      0          
          5        SEND_VAR                                                 $0
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Function teststringcast:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GI3Y7
function name:  testStringCast
number of ops:  7
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   25     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        GET_CLASS                                        ~1      !0
          4        SEND_VAL                                                 ~1
          5        DO_ICALL                                                 
   26     6      > RETURN                                                   null

End of function teststringcast

Class StringCastable:
Function __constructor:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GI3Y7
function name:  __constructor
number of ops:  4
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ                                               'data'
          2        OP_DATA                                                  !0
   10     3      > RETURN                                                   null

End of function __constructor

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GI3Y7
function name:  __toString
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_METHOD_CALL                                         'toString'
          1        DO_FCALL                                      0  $0      
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   15     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function __tostring

Function tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GI3Y7
function name:  toString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                      ~0      'data'
          1      > RETURN                                                   ~0
   20     2*     > RETURN                                                   null

End of function tostring

End of class StringCastable.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.24 ms | 1407 KiB | 16 Q