3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $items = [ 'some', 'test', 'stuff', 1, ]; $filtered = array_filter($items, function ($item) { return is_string($item); }); $capitalized = array_map(function ($item) { return strtoupper($item); }, $filtered); $result = array_reduce($capitalized, function ($carry, $item) { return $carry . $item; }); print_r($result); $result = ''; foreach ($items as $item) { if (is_string($item)) { $result .= strtoupper($item); } } print_r($result);
based on LfDCn
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0alpha1
SOMETESTSTUFFSOMETESTSTUFF