jimw Fri Dec 14 15:27:08 2001 EDT
Modified files:
/phpdoc/en/functions strings.xml
Log:
print: &return.success;, add examples
Index: phpdoc/en/functions/strings.xml
diff -u phpdoc/en/functions/strings.xml:1.137 phpdoc/en/functions/strings.xml:1.138
--- phpdoc/en/functions/strings.xml:1.137 Fri Dec 14 15:09:33 2001
+++ phpdoc/en/functions/strings.xml Fri Dec 14 15:27:08 2001
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.137 $ -->
+<!-- $Revision: 1.138 $ -->
<reference id="ref.strings">
<title>String functions</title>
<titleabbrev>Strings</titleabbrev>
@@ -1741,10 +1741,49 @@
</funcprototype>
</funcsynopsis>
<simpara>
- Outputs <parameter>arg</parameter>.
+ Outputs <parameter>arg</parameter>. &return.success;
</simpara>
+ <example>
+ <title><function>print</function> examples</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+print("Hello World");
+
+print "print() also works without parentheses.";
+
+print "This spans
+multiple lines. The newlines will be
+output as well";
+
+print "This spans\nmultiple lines. The newlines will be\noutput as well.";
+
+print "escaping characters is done \"Like this\"."
+
+//You can use variables inside of an print statement
+$foo = "foobar";
+$bar = "barbaz";
+
+print "foo is $foo"; // foo is foobar
+
+// Using single quotes will print the variable name, not the value
+print 'foo is $foo'; // foo is $foo
+
+// If you are not using any other characters, you can just print variables
+print $foo; // foobar
+
+print <<<END
+This uses the "here document" syntax to output
+multiple lines with $variable interpolation. Note
+that the here document terminator must appear on a
+line with just a semicolon no extra whitespace!
+END;
+?>
+]]>
+ </programlisting>
+ </example>
<simpara>
- See also: <function>echo</function>, <function>printf</function>,
+ See also <function>echo</function>, <function>printf</function>,
and <function>flush</function>.
</simpara>
</refsect1>