3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testValues = [ 'positives' => ['121', '231.45', '77,65', '9.456,77', '4,255.66'], // should pass 'negatives' => ['-121', '-231.45', '-77,65', '-9.456,77', '-4,255.66'], // should pass 'gibberish' => ['231.45a', '7a7,65', 'a9.456,77', '4,255.66a', 'aaaaaa'], // should fail ]; function customIsNumeric(string $value): bool { return is_numeric(str_replace(['.', ','], '', $value)); } foreach ($testValues as $category => $values) { var_dump($category); foreach ($values as $value) { var_dump(customIsNumeric($value)); } }
Output for git.master, git.master_jit, rfc.property-hooks
string(9) "positives" bool(true) bool(true) bool(true) bool(true) bool(true) string(9) "negatives" bool(true) bool(true) bool(true) bool(true) bool(true) string(9) "gibberish" bool(false) bool(false) bool(false) bool(false) bool(false)

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:
29.82 ms | 406 KiB | 5 Q