3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input="1234567890"; function format_phone_number($input) { $stripped = preg_replace('/[^0-9]/', '', $input); $len = strlen($stripped); if ($len === 10) { return '1' . $stripped; } if ($len === 11 && $stripped[0] === '1') { return $stripped; } } function validate_phone_number($input) { if (format_phone_number($input) == 11) { return true; } else { return false; } } if (validate_phone_number($input)) { echo "valid"; }; ?>
Output for git.master, git.master_jit, rfc.property-hooks

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:
99.5 ms | 1682 KiB | 4 Q