3v4l.org

run code in 300+ PHP versions simultaneously
<?php class OnlyPendingDeletion extends FilterIterator { public function __construct(array $items) { parent::__construct(new ArrayIterator($items)); } public function accept() { $item = $this->current(); $fourthOfJan = strtotime('2014-01-04'); return $fourthOfJan > strtotime($item['date']); } } $items = array( array('id' => 1, 'date' > '2014-01-01'), array('id' => 2, 'date' > '2014-01-02'), array('id' => 3, 'date' > '2014-01-03'), array('id' => 4, 'date' > '2014-01-04'), array('id' => 5, 'date' > '2014-01-05'), array('id' => 6, 'date' > '2014-01-06'), array('id' => 7, 'date' > '2014-01-07'), ); $items = new OnlyPendingDeletion($items); echo 'Pending: ', count($items), PHP_EOL; foreach ($items as $item) { echo 'id: ', $item['id'], PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/5GZtS
function name:  (null)
number of ops:  18
compiled vars:  !0 = $items, !1 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   23     1        NEW                                              $3      'OnlyPendingDeletion'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $3
   25     5        ECHO                                                     'Pending%3A+'
          6        COUNT                                            ~6      !0
          7        ECHO                                                     ~6
          8        ECHO                                                     '%0A'
   27     9      > FE_RESET_R                                       $7      !0, ->16
         10    > > FE_FETCH_R                                               $7, !1, ->16
   28    11    >   ECHO                                                     'id%3A+'
         12        FETCH_DIM_R                                      ~8      !1, 'id'
         13        ECHO                                                     ~8
         14        ECHO                                                     '%0A'
   27    15      > JMP                                                      ->10
         16    >   FE_FREE                                                  $7
   29    17      > RETURN                                                   1

Class OnlyPendingDeletion:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5GZtS
function name:  __construct
number of ops:  8
compiled vars:  !0 = $items
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_STATIC_METHOD_CALL                                  
          2        NEW                                              $1      'ArrayIterator'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        SEND_VAR_NO_REF_EX                                       $1
          6        DO_FCALL                                      0          
    5     7      > RETURN                                                   null

End of function __construct

Function accept:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5GZtS
function name:  accept
number of ops:  14
compiled vars:  !0 = $item, !1 = $fourthOfJan
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_METHOD_CALL                                         'current'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
    8     3        INIT_FCALL                                               'strtotime'
          4        SEND_VAL                                                 '2014-01-04'
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !1, $4
    9     7        INIT_FCALL                                               'strtotime'
          8        FETCH_DIM_R                                      ~6      !0, 'date'
          9        SEND_VAL                                                 ~6
         10        DO_ICALL                                         $7      
         11        IS_SMALLER                                       ~8      $7, !1
         12      > RETURN                                                   ~8
   10    13*     > RETURN                                                   null

End of function accept

End of class OnlyPendingDeletion.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.8 ms | 1400 KiB | 15 Q