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); } } // Super-secret generics library: exec(base64_decode('CmNsYXNzIFQgZXh0ZW5kcyBcRGF0ZVRpbWUge30KY2xhc3MgRGF0ZVRpbWUgZXh0ZW5kcyBUIHt9OwpjbGFzcyBDb2xsZWN0aW9u4ZC4RGF0ZVRpbWXhkLMgZXh0ZW5kcyBDb2xsZWN0aW9u4ZC4VOGQsyB7fQ==')); $dates = new CollectionᐸDateTimeᐳ(); $dates->add(new DateTime('yesterday')); $dates->add(new DateTime('today')); $dates->add(new DateTime('tomorrow')); echo count($dates);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IasqI
function name:  (null)
number of ops:  33
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'
   21     1        INIT_NS_FCALL_BY_NAME                                    'Generics%5Cexec'
          2        INIT_NS_FCALL_BY_NAME                                    'Generics%5Cbase64_decode'
          3        SEND_VAL_EX                                              'CmNsYXNzIFQgZXh0ZW5kcyBcRGF0ZVRpbWUge30KY2xhc3MgRGF0ZVRpbWUgZXh0ZW5kcyBUIHt9OwpjbGFzcyBDb2xsZWN0aW9u4ZC4RGF0ZVRpbWXhkLMgZXh0ZW5kcyBDb2xsZWN0aW9u4ZC4VOGQsyB7fQ%3D%3D'
          4        DO_FCALL                                      0  $1      
          5        SEND_VAR_NO_REF_EX                                       $1
          6        DO_FCALL                                      0          
   23     7        NEW                                              $3      'Generics%5CCollection%E1%90%B8DateTime%E1%90%B3'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !0, $3
   25    10        INIT_METHOD_CALL                                         !0, 'add'
         11        NEW                                              $6      'Generics%5CDateTime'
         12        SEND_VAL_EX                                              'yesterday'
         13        DO_FCALL                                      0          
         14        SEND_VAR_NO_REF_EX                                       $6
         15        DO_FCALL                                      0          
   26    16        INIT_METHOD_CALL                                         !0, 'add'
         17        NEW                                              $9      'Generics%5CDateTime'
         18        SEND_VAL_EX                                              'today'
         19        DO_FCALL                                      0          
         20        SEND_VAR_NO_REF_EX                                       $9
         21        DO_FCALL                                      0          
   27    22        INIT_METHOD_CALL                                         !0, 'add'
         23        NEW                                              $12     'Generics%5CDateTime'
         24        SEND_VAL_EX                                              'tomorrow'
         25        DO_FCALL                                      0          
         26        SEND_VAR_NO_REF_EX                                       $12
         27        DO_FCALL                                      0          
   29    28        INIT_NS_FCALL_BY_NAME                                    'Generics%5Ccount'
         29        SEND_VAR_EX                                              !0
         30        DO_FCALL                                      0  $15     
         31        ECHO                                                     $15
         32      > 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/IasqI
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/IasqI
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ᐳ.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.5 ms | 1400 KiB | 19 Q