+3  A: 

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
using `elseif ((int)$mInput == $mInput)` triggers on real strings too
Sirber
+1 for switch! :D
Sirber
that seems to work:`case (is_numeric($mInput)): if (intval($mInput) != $mInput) break;`
Sirber
great, i saw this use of the switch few days ago here on SO :)
Cesar
mmm wouldn't it be `intval($mInput) == $mInput)` ? but it doesn't work as expected that way :S
Sirber
4 == "0004", I must use "==="
Sirber
this is so a mess :)
Sirber
`(string) intval("0004") === "0004"` -> false
Sirber
Cesar