note 33402 added to language.variables

From: Date: Tue, 24 Jun 2003 21:36:58 +0000
Subject: note 33402 added to language.variables
Groups: php.notes 
Request: Send a blank email to php-notes+get-50966@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/language.variables.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33402 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33402&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33402&report=yes

« previous php.notes (#50966) next »