instead of is_numeric()
use (int)$var == $var
I saw a beautiful use of the switch, should be something like this:
function sqlize($mInput)
{
switch(TRUE)
{
default:
case (!isset($mInput)): $mInput = "null"; break;
case (strtolower($mInput) == "null"): break;
case (is_numeric($mInput)): break;
case (is_string($mInput)):
$mInput = trim($mInput);
$mInput = addslashes($mInput);
$mInput = '"' . $mInput . '"';
break;
}
return $mInput;
}
Cesar
2010-04-30 15:17:06