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']); } } $array = 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; }
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of OnlyPendingDeletion::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/mLIgp on line 6 Warning: Undefined variable $items in /in/mLIgp on line 23 Fatal error: Uncaught TypeError: OnlyPendingDeletion::__construct(): Argument #1 ($items) must be of type array, null given, called in /in/mLIgp on line 23 and defined in /in/mLIgp:3 Stack trace: #0 /in/mLIgp(23): OnlyPendingDeletion->__construct(NULL) #1 {main} thrown in /in/mLIgp on line 3
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
35.62 ms | 402 KiB | 8 Q