3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(stringToEnglishNumber('-214-277. 4404-', ', ')); function stringToEnglishNumber($string, $separator = ' ') { $sanitized = preg_replace("/[^\-0-9,. ]/", '', $string); $split = str_split($sanitized); if (empty($split)) { return $string; } if ($split[0] == '-') { $split[0] = 'negative'; } $convert = [ '-' => 'dash', '.' => 'dot', ' ' => 'space', ]; foreach ($split as $key => $char) { if (array_key_exists($char, $convert)) { $split[$key] = $convert[$char]; } } return implode("{$separator}", $split); }
Output for git.master, git.master_jit, rfc.property-hooks
string(62) "negative, 2, 1, 4, dash, 2, 7, 7, dot, space, 4, 4, 0, 4, dash"

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:
49.91 ms | 401 KiB | 8 Q