When I execute the following script:
<?php
$num = 3;
list($num, $dec) = explode(".", $num);
?>
PHP says:
Notice: Undefined offset: 1 in /home/www/test.php on line 3
Other than disabling these notices, is there a way I can prevent this notice from showing up?
try this
EDIT for completeness:
alternatively you can also use number_format:
as suggested by Bojan Dević