mirror of
https://github.com/php/doc-it.git
synced 2026-03-25 08:02:09 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/it/trunk@334474 c90b9560-bf6c-de11-be94-00142212c4b1
175 lines
5.0 KiB
XML
175 lines
5.0 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: cucinato Status: ready -->
|
|
<refentry xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://docbook.org/ns/docbook" xml:id="function.echo">
|
|
<refnamediv>
|
|
<refname>echo</refname>
|
|
<refpurpose>Visualizza una o più stringhe</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>void</type><methodname>echo</methodname>
|
|
<methodparam><type>string</type><parameter>arg1</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>...</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
Visualizza tutti i parametri.
|
|
</simpara>
|
|
<para>
|
|
<function>echo</function> in realtà non è una funzione (è un
|
|
costrutto del linguaggio) pertanto non richiede l'uso di
|
|
parentesi. <function>echo</function> (diversamente da altri costrutti
|
|
del linguaggio)) non si comporta come una funzion, quindi non può
|
|
essere sempre usata nel constesto di una funzione. Inoltre,se si vuole
|
|
passare più di un parametro a <function>echo</function>, i parametri
|
|
non devono essere racchiusi tra parentesi.
|
|
</para>
|
|
<para>
|
|
<function>echo</function> ha anche una sintassi abbreviata, nella quale si può
|
|
immediatamente seguire il simbolo di apertura del tag con un simbolo di uguale. questa sintassi abbreviata
|
|
funziona solo se la configurazione <link
|
|
linkend="ini.short-open-tag">short_open_tag</link> è
|
|
abilitata.
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
Numero di foo: <?=$foo?>.
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>arg1</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Il parametro da visualizzare.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>...</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.void;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Esempi della funzione <function>echo</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
echo "Hello World";
|
|
|
|
echo "This spans
|
|
multiple lines. The newlines will be
|
|
output as well";
|
|
|
|
echo "This spans\nmultiple lines. The newlines will be\noutput as well.";
|
|
|
|
echo "Escaping characters is done \"Like this\".";
|
|
|
|
// Si possono utilizzare variabili all'interno dei parametri di echo
|
|
$foo = "foobar";
|
|
$bar = "barbaz";
|
|
|
|
echo "foo is $foo"; // foo is foobar
|
|
|
|
// Si possono utilizzare anche delle matrici
|
|
$baz = array("value" => "foo");
|
|
|
|
echo "this is {$baz['value']} !"; // this is foo !
|
|
|
|
// Utilizzando gli apici singoli viene visualizzato il nome della variabile, non il valore
|
|
echo 'foo is $foo'; // foo is $foo
|
|
|
|
// Se non vi sono altri caratteri, si può visualizzare soltanto il contenuto delle variabili
|
|
echo $foo; // foobar
|
|
echo $foo,$bar; // foobarbarbaz
|
|
|
|
// Alcuni programmatori preferiscono passare i parametri come sequenza di stringhe concatenate.
|
|
echo 'This ', 'string ', 'was ', 'made ', 'with multiple parameters.', chr(10);
|
|
echo 'This ' . 'string ' . 'was ' . 'made ' . 'with concatenation.' . "\n";
|
|
|
|
echo <<<END
|
|
Questo esempio utilizza la sintassi "here document"
|
|
per visualizzare più linee oltre al contenuto di $variable
|
|
Notare che il terminatore del testo richiede
|
|
anche il punto e virgola, senza alcun spazio aggiuntivo!
|
|
END;
|
|
|
|
// Poiché echo non è una funzione la seguente riga non è valida.
|
|
($some_var) ? echo 'true' : echo 'false';
|
|
|
|
// Tuttavia la seguente funziona
|
|
($some_var) ? print 'true' : print 'false'; // print è un costrutto, ma
|
|
// si comporta come una funzione, quindi
|
|
// può essere utilizzato in questo contesto.
|
|
echo $some_var ? 'true': 'false'; // altra versione dell'istruzione
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
¬e.language-construct;
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>print</function></member>
|
|
<member><function>printf</function></member>
|
|
<member><function>flush</function></member>
|
|
<member><link linkend="language.types.string.syntax.heredoc">sintassi heredoc</link></member>
|
|
</simplelist>
|
|
</para>
|
|
</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:"~/.phpdoc/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
|
|
-->
|