- ctype_digit: documentation ( source)
<?php
$a = '23bc';
$b = '';
$c = '123';
$d = null;
echo ( !strlen($a) || ctype_digit($a) )? "Good to Go\n" : "Bad to Go\n";
echo ( !strlen($b) || ctype_digit($b) )? "Good to Go\n" : "Bad to Go\n";
echo ( !strlen($c) || ctype_digit($c) )? "Good to Go\n" : "Bad to Go\n";
echo ( !strlen($d) || ctype_digit($c) )? "Good to Go\n" : "Bad to Go\n";