3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Victim { protected $money = 100; public function __toString() { return (string) $this->money; } } class Offender extends Victim { function assault(Victim $victim) { $victim->money = 0; } } $victim = new Victim; $offender = new Offender; $offender->assault($victim); print (string)$victim;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8J3et
function name:  (null)
number of ops:  14
compiled vars:  !0 = $victim, !1 = $offender
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'victim'
   10     1        DECLARE_CLASS                                            'offender', 'victim'
   16     2        NEW                                              $2      'Victim'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   17     5        NEW                                              $5      'Offender'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $5
   18     8        INIT_METHOD_CALL                                         !1, 'assault'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0          
   19    11        CAST                                          6  ~9      !0
         12        ECHO                                                     ~9
         13      > RETURN                                                   1

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

End of function __tostring

End of class Victim.

Class Offender:
Function assault:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8J3et
function name:  assault
number of ops:  4
compiled vars:  !0 = $victim
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        ASSIGN_OBJ                                               !0, 'money'
          2        OP_DATA                                                  0
   13     3      > RETURN                                                   null

End of function assault

End of class Offender.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.99 ms | 1395 KiB | 13 Q