cvs: /phpdoc/language types.sgml

From: Date: Tue, 16 Nov 1999 04:19:37 +0000
Subject: cvs: /phpdoc/language types.sgml
Groups: php.dev 
Request: Send a blank email to php-dev+get-12594@lists.php.net to get a copy of this message
cslawi Mon Nov 15 23:19:37 1999 EDT Modified files: /phpdoc/language types.sgml Log: Add some simple string usage examples. Index: phpdoc/language/types.sgml diff -u phpdoc/language/types.sgml:1.9 phpdoc/language/types.sgml:1.10 --- phpdoc/language/types.sgml:1.9 Mon Nov 15 21:23:40 1999 +++ phpdoc/language/types.sgml Mon Nov 15 23:19:36 1999 @@ -117,12 +117,40 @@ </table></para> <para> You can escape any other character, but a warning will be issued - at the highest warning level.</para> - <para> + at the highest warning level. + </para> + <para> The second way to delimit a string uses the single-quote ("'") character, which does not do any variable expansion or backslash processing (except for "\\" and "\'" so you can insert backslashes - and single-quotes in a singly-quoted string).</para> + and single-quotes in a singly-quoted string). + </para> + + <para> + <example> + <title>Some string examples</title> + <programlisting> +&lt;?php +/* Assigning a string. */ +$str = "This is a string"; + +/* Appending to it. */ +$str = $str . " with some more text"; + +/* Another way to append, includes an escaped newline. */ +$str .= " and a newline at the end.\n"; + +/* This string will end up being '&lt;p&gt;Number: 9&lt;/p&gt;' */ +$num = 9; +$str = "&lt;p&gt;Number: $num&lt;/p&gt;"; + +/* This one will be '&lt;p&gt;Number: $num&lt;/p&gt;' */ +$num = 9; +$str = '&lt;p&gt;Number: $num&lt;/p&gt;'; +?&gt; + </programlisting> + </example> + </para> <sect2 id="language.types.string.conversion"> <title>String conversion</title>

« previous php.dev (#12594) next »