3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bookData = []; foreach ([1, 2, 3, 5, 8, 13, 21] as $value) { $book = new stdClass; $book->price = $value; $bookData[] = $book; } $priceFilter = function($minimumValue, $maximumValue) { return function($value) use ($minimumValue, $maximumValue) { return $value->price >= $minimumValue && $value->price < $maximumValue; }; }; var_dump(array_filter( $bookData, $priceFilter(5.00, 15.00) )); var_dump(array_filter( $bookData, $priceFilter(1.00, 10.00) ));
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [3]=> object(stdClass)#4 (1) { ["price"]=> int(5) } [4]=> object(stdClass)#5 (1) { ["price"]=> int(8) } [5]=> object(stdClass)#6 (1) { ["price"]=> int(13) } } array(5) { [0]=> object(stdClass)#1 (1) { ["price"]=> int(1) } [1]=> object(stdClass)#2 (1) { ["price"]=> int(2) } [2]=> object(stdClass)#3 (1) { ["price"]=> int(3) } [3]=> object(stdClass)#4 (1) { ["price"]=> int(5) } [4]=> object(stdClass)#5 (1) { ["price"]=> int(8) } }

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:
57.05 ms | 402 KiB | 8 Q