<?php function castNumber($n) { if(!is_numeric($n)) return 0; return (is_float($n)) ? (float) $n : (int) $n; } var_dump($casted = castNumber('8'));
You have javascript disabled. You will not be able to edit any code.