3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(1, "apples",2, "oranges",3, "plums"); $filtered = array_filter($array, 'ctype_alpha'); $callback = function($item) { return strtoupper($item); }; $nu = array_map( $callback, $filtered); var_dump($nu); ?>
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Deprecated: ctype_alpha(): Argument of type int will be interpreted as string in the future in /in/f6AOo on line 3 Deprecated: ctype_alpha(): Argument of type int will be interpreted as string in the future in /in/f6AOo on line 3 Deprecated: ctype_alpha(): Argument of type int will be interpreted as string in the future in /in/f6AOo on line 3 array(3) { [1]=> string(6) "APPLES" [3]=> string(7) "ORANGES" [5]=> string(5) "PLUMS" }
Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
array(3) { [1]=> string(6) "APPLES" [3]=> string(7) "ORANGES" [5]=> string(5) "PLUMS" }

preferences:
188.86 ms | 404 KiB | 256 Q