php-doc-en/reference/strings/functions/print.xml
Georg Richter b452ebaf85 print can't be used as a variable function
see also bug #16739


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@88104 c90b9560-bf6c-de11-be94-00142212c4b1
2002-07-08 18:52:33 +00:00

88 lines
2.3 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 -->
<refentry id="function.print">
<refnamediv>
<refname>print</refname>
<refpurpose>Output a string</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<methodname>print</methodname>
<methodparam><type>string</type><parameter>arg</parameter></methodparam>
</methodsynopsis>
<simpara>
Outputs <parameter>arg</parameter>. &return.success;
</simpara>
<para>
<function>print</function> is not actually a real function (it is a
language construct) so you are not required to use parentheses
with it.
</para>
<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>,
and <function>flush</function>.
</simpara>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->