3v4l.org

run code in 300+ PHP versions simultaneously
<?php $number = ['1,2', 1, '']; foreach ($number as $val) { if (!empty($val) || !ctype_alpha($val)) echo "val: $val is_numeric ".is_numeric(number_format($val))."\n\r"; } $number = 'abc1,2def'; $number = preg_replace("/[a-zA-Z]/i", '', $number); echo 'is numeric? '.is_numeric(number_format($number));

preferences:
29.72 ms | 407 KiB | 5 Q