cvs: /phpdoc/language variables.sgml

From: Date: Sat, 13 Nov 1999 22:47:24 +0000
Subject: cvs: /phpdoc/language variables.sgml
Groups: php.dev 
Request: Send a blank email to php-dev+get-12468@lists.php.net to get a copy of this message
cslawi Sat Nov 13 17:47:24 1999 EDT Modified files: /phpdoc/language variables.sgml Log: Added note about dots being changed to underscores in incoming variable names. Index: phpdoc/language/variables.sgml diff -u phpdoc/language/variables.sgml:1.3 phpdoc/language/variables.sgml:1.4 --- phpdoc/language/variables.sgml:1.3 Wed Oct 20 18:52:31 1999 +++ phpdoc/language/variables.sgml Sat Nov 13 17:47:23 1999 @@ -339,6 +339,31 @@ can also set an environment variable with the <function>putenv</function> function.</para></sect2> + <sect2> + <title>Dots in incoming variable names</title> + + <para> + Typically, PHP does not alter the names of variables when they are + passed into a script. However, it should be noted that the dot + (period, full stop) is not a valid character in a PHP + variable name. For the reason, look at it: + <programlisting> +$varname.ext; /* invalid variable name */ + </programlisting> + Now, what the parser sees is a variable named $varname, followed + by the string concatenation operator, followed by the barestring + (i.e. unquoted string which doesn't match any known key or + reserved words) 'ext'. Obviously, this doesn't have the intended + result. + </para> + + <para> + For this reason, it is important to note that PHP will + automatically replace any dots in incoming variable names with + underscores. + </para> + </sect2> + <sect2> <title>Determining variable types</title> @@ -350,7 +375,10 @@ <function>gettype</function>, <function>is_long</function>, <function>is_double</function>, <function>is_string</function>, <function>is_array</function>, and - <function>is_object</function>.</para></sect2></sect1> + <function>is_object</function>. + </para> + </sect2> + </sect1> </chapter>

« previous php.dev (#12468) next »