3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Generics; class CollectionᐸTᐳ implements \Countable { private $items = []; public function add(T $item) { $this->items[] = $item; } public function count() { return count($this->items); } } $dates = new CollectionᐸDateTimeᐳ(); $dates->add(new DateTime('yesterday')); $dates->add(new DateTime('today')); $dates->add(new DateTime('tomorrow')); echo count($dates); class T extends \DateTime {} class DateTime extends T {}; class CollectionᐸDateTimeᐳ extends CollectionᐸTᐳ {}
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0f4HL
function name:  (null)
number of ops:  28
compiled vars:  !0 = $dates
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                            'generics%5Ccollection%E1%90%B8t%E1%90%B3'
   20     1        NEW                                              $1      'Generics%5CCollection%E1%90%B8DateTime%E1%90%B3'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   22     4        INIT_METHOD_CALL                                         !0, 'add'
          5        NEW                                              $4      'Generics%5CDateTime'
          6        SEND_VAL_EX                                              'yesterday'
          7        DO_FCALL                                      0          
          8        SEND_VAR_NO_REF_EX                                       $4
          9        DO_FCALL                                      0          
   23    10        INIT_METHOD_CALL                                         !0, 'add'
         11        NEW                                              $7      'Generics%5CDateTime'
         12        SEND_VAL_EX                                              'today'
         13        DO_FCALL                                      0          
         14        SEND_VAR_NO_REF_EX                                       $7
         15        DO_FCALL                                      0          
   24    16        INIT_METHOD_CALL                                         !0, 'add'
         17        NEW                                              $10     'Generics%5CDateTime'
         18        SEND_VAL_EX                                              'tomorrow'
         19        DO_FCALL                                      0          
         20        SEND_VAR_NO_REF_EX                                       $10
         21        DO_FCALL                                      0          
   26    22        INIT_NS_FCALL_BY_NAME                                    'Generics%5Ccount'
         23        SEND_VAR_EX                                              !0
         24        DO_FCALL                                      0  $13     
         25        ECHO                                                     $13
   68    26        DECLARE_CLASS                                            'generics%5Ccollection%E1%90%B8datetime%E1%90%B3', 'generics%5Ccollection%E1%90%B8t%E1%90%B3'
         27      > RETURN                                                   1

Class Generics\CollectionᐸTᐳ:
Function add:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0f4HL
function name:  add
number of ops:  5
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        FETCH_OBJ_W                                      $1      'items'
          2        ASSIGN_DIM                                               $1
          3        OP_DATA                                                  !0
   12     4      > RETURN                                                   null

End of function add

Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0f4HL
function name:  count
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_NS_FCALL_BY_NAME                                    'Generics%5Ccount'
          1        CHECK_FUNC_ARG                                           
          2        FETCH_OBJ_FUNC_ARG                               $0      'items'
          3        SEND_FUNC_ARG                                            $0
          4        DO_FCALL                                      0  $1      
          5      > RETURN                                                   $1
   17     6*     > RETURN                                                   null

End of function count

End of class Generics\CollectionᐸTᐳ.

Class Generics\T: [no user functions]
Class Generics\DateTime: [no user functions]
Class Generics\CollectionᐸDateTimeᐳ: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.72 ms | 1400 KiB | 15 Q