3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyFilter extends FilterIterator implements Countable { public function accept() { return true; } public function count() { return $this->getInnerIterator()->count(); } } $it = new ArrayIterator(array(1, 2, 3)); $fi = new MyFilter($it); var_dump($it->count()); var_dump($fi->count()); var_dump(count($it)); var_dump(count($fi));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gfZrT
function name:  (null)
number of ops:  28
compiled vars:  !0 = $it, !1 = $fi
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'myfilter', 'filteriterator'
   16     1        NEW                                              $2      'ArrayIterator'
          2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   17     5        NEW                                              $5      'MyFilter'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $5
   19     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !0, 'count'
         11        DO_FCALL                                      0  $8      
         12        SEND_VAR                                                 $8
         13        DO_ICALL                                                 
   20    14        INIT_FCALL                                               'var_dump'
         15        INIT_METHOD_CALL                                         !1, 'count'
         16        DO_FCALL                                      0  $10     
         17        SEND_VAR                                                 $10
         18        DO_ICALL                                                 
   22    19        INIT_FCALL                                               'var_dump'
         20        COUNT                                            ~12     !0
         21        SEND_VAL                                                 ~12
         22        DO_ICALL                                                 
   23    23        INIT_FCALL                                               'var_dump'
         24        COUNT                                            ~14     !1
         25        SEND_VAL                                                 ~14
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Class MyFilter:
Function accept:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gfZrT
function name:  accept
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E > > RETURN                                                   <true>
    8     1*     > RETURN                                                   null

End of function accept

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

End of function count

End of class MyFilter.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
131.32 ms | 1405 KiB | 15 Q