3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function endswithy($value) { return (substr($value, -1) == 'y'); } $people = array("Johnny", "Timmy", "Bobby", "Sam", "Tammy", "Danny", "Joe"); $withy = array_filter($people, "endswithy"); var_dump($withy); ?>
based on eMQOX
Output for 4.3.0 - 7.2.0
array(5) { [0]=> string(6) "Johnny" [1]=> string(5) "Timmy" [2]=> string(5) "Bobby" [4]=> string(5) "Tammy" [5]=> string(5) "Danny" }