RE: [PHP] converting a char variable to an int?

From: Date: Mon, 14 Jun 2004 15:38:34 +0000
Subject: RE: [PHP] converting a char variable to an int?
Groups: php.general 
Request: Send a blank email to php-general+get-188227@lists.php.net to get a copy of this message
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 <awilliam@mdah.state.ms.us> > To: <php-general@lists.php.net> > 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

« previous php.general (#188227) next »