3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Parcel { protected $weight; protected $destinationCountry; public function setWeight($weight) { echo "the weight is" . $weight; $this->weight = $weight; return $this; } public function setCountry($destinationCountry) { echo "country is " . $destinationCountry; $this->destinationCountry = $destinationCountry; return $this; } } class Courier implements Countable { protected $count = 0; public function ship(Parcel $parcel) { $this->count++; return true; } public function count() { return $this->count; } } $courier = new Courier(); $courier->ship(new Parcel()); $courier->ship(new Parcel()); $courier->ship(new Parcel()); $courier->ship(new Parcel()); echo count($courier);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S8HIc
function name:  (null)
number of ops:  27
compiled vars:  !0 = $courier
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   DECLARE_CLASS                                            'courier'
   33     1        NEW                                              $1      'Courier'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   34     4        INIT_METHOD_CALL                                         !0, 'ship'
          5        NEW                                              $4      'Parcel'
          6        DO_FCALL                                      0          
          7        SEND_VAR_NO_REF_EX                                       $4
          8        DO_FCALL                                      0          
   35     9        INIT_METHOD_CALL                                         !0, 'ship'
         10        NEW                                              $7      'Parcel'
         11        DO_FCALL                                      0          
         12        SEND_VAR_NO_REF_EX                                       $7
         13        DO_FCALL                                      0          
   36    14        INIT_METHOD_CALL                                         !0, 'ship'
         15        NEW                                              $10     'Parcel'
         16        DO_FCALL                                      0          
         17        SEND_VAR_NO_REF_EX                                       $10
         18        DO_FCALL                                      0          
   37    19        INIT_METHOD_CALL                                         !0, 'ship'
         20        NEW                                              $13     'Parcel'
         21        DO_FCALL                                      0          
         22        SEND_VAR_NO_REF_EX                                       $13
         23        DO_FCALL                                      0          
   38    24        COUNT                                            ~16     !0
         25        ECHO                                                     ~16
         26      > RETURN                                                   1

Class Parcel:
Function setweight:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S8HIc
function name:  setWeight
number of ops:  8
compiled vars:  !0 = $weight
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        CONCAT                                           ~1      'the+weight+is', !0
          2        ECHO                                                     ~1
    8     3        ASSIGN_OBJ                                               'weight'
          4        OP_DATA                                                  !0
    9     5        FETCH_THIS                                       ~3      
          6      > RETURN                                                   ~3
   10     7*     > RETURN                                                   null

End of function setweight

Function setcountry:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S8HIc
function name:  setCountry
number of ops:  8
compiled vars:  !0 = $destinationCountry
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        CONCAT                                           ~1      'country+is+', !0
          2        ECHO                                                     ~1
   14     3        ASSIGN_OBJ                                               'destinationCountry'
          4        OP_DATA                                                  !0
   15     5        FETCH_THIS                                       ~3      
          6      > RETURN                                                   ~3
   16     7*     > RETURN                                                   null

End of function setcountry

End of class Parcel.

Class Courier:
Function ship:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S8HIc
function name:  ship
number of ops:  4
compiled vars:  !0 = $parcel
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1        PRE_INC_OBJ                                              'count'
   24     2      > RETURN                                                   <true>
   26     3*     > RETURN                                                   null

End of function ship

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

End of function count

End of class Courier.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.53 ms | 1399 KiB | 13 Q