You could cast the type when you create the variable:
$variable = (integer) $variable;
Or you could set the type:
settype ($variable, "integer");
However, the problem may be with the database, depending on what you mean
by "it's not working in my database this way."
> [Original Message]
> From: Adam Williams <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Date: 06/14/2004 8:32:18 AM
> Subject: [PHP] converting a char variable to an int?
>
> Hi, I have a variable that is created using the date command:
>
> $date = date("Ymd");
>
> but its not working in my database this way (when I explicity enter
> 20040614 in my database, it works though). so I think PHP is making
$date
> a character variable, so how can I force or change the caste of $date to
> force it to be an integer variable? thanks
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php