note 33402 deleted from language.variables by nlopess
| From: | nlopess@php.net | Date: | Fri, 24 Dec 2004 20:31:42 +0000 |
| Subject: | note 33402 deleted from language.variables by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82268@lists.php.net to get a copy of this message | ||
Note Submitter: redshift at pandora dot be
----
There are several ways of declaring variabeles. (Sort of like the Dim instruction in vb or asp)
settype($myvar, "string");
(http://be2.php.net/settype)
or
$myvar = (string) "Hello";
Or let php do the hard work for you,
$myvar = "Hello";
It should normally produce the same result...
NOTE:
$myvar = 1; is not the same as $myvar = "1";
Whereas the first would count as an integer, the second as a string. Altough php see trough these
things, a database query would not. For example:
odbc_query("INSERT INTO table (number) VALUES(' ".$myvar." ')"); WILL
NOT work,
odbc_query("INSERT INTO table (number) VALUES (".$myvar.")"); WOULD work.