3v4l.org

run code in 300+ PHP versions simultaneously
<?php function formatAds(array $ad): array { $ad['last_name'] = ucfirst($ad['last_name']); $ad['first_name'] = ucfirst($ad['first_name']); $phoneNumber = str_replace(' ', '', $ad['phone_number']); $ad['phone_number'] = is_numeric($phoneNumber) && strlen($phoneNumber) === 10 ? $phoneNumber : null; return $ad; } $ad = [ "last_name" => "foo", "first_name" => "bar", "phone_number" => "04 55 66 77 11", ]; print_r(formatAds($ad));
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [last_name] => Foo [first_name] => Bar [phone_number] => 0455667711 )

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:
128.27 ms | 405 KiB | 5 Q