On Nov 13, 2007 2:56 PM, dann <[EMAIL PROTECTED]> wrote: > One small caveat I failed to mention earlier: while ctype_digit will > work fine for parsing the superglobals, if you are instead parsing an > unknown variable that might be an actual integer, a string containing > an integer, or a non-integer string, you'll need to first cast it to > a string before you apply ctype_digit, as that function returns false > if you pass it an actual integer. It's an easy "feature" to forget, > and as I did exactly that myself a few minutes ago I thought I'd > mention it to potentially save you some time in the future. > > $string = '42'; > $int = 42; > var_dump(ctype_digit($string), ctype_digit((string) $int), ctype_digit > ($int));
Easily fixed with: ctype_digit("$int"); With the added bonus, that another dev will come behind you, remove the quotes, and create a bug. :) _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php