svn: /phpdoc/it/trunk/language/types/ object.xml
| From: | Davide Pastore | Date: | Thu, 10 Nov 2016 20:53:45 +0000 |
| Subject: | svn: /phpdoc/it/trunk/language/types/ object.xml | ||
| Groups: | php.doc.it | ||
| Request: | Send a blank email to doc-it+get-2052@lists.php.net to get a copy of this message | ||
pastore Thu, 10 Nov 2016 20:53:45 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=340944
Log:
Sync with EN
Changed paths:
A phpdoc/it/trunk/language/types/object.xml
Added: phpdoc/it/trunk/language/types/object.xml
===================================================================
--- phpdoc/it/trunk/language/types/object.xml (rev 0)
+++ phpdoc/it/trunk/language/types/object.xml 2016-11-10 20:53:45 UTC (rev 340944)
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- EN-Revision: 335216 Maintainer: SvenHolmgren Status: ready -->
+<sect1 xml:id="language.types.object">
+ <title>Objects</title>
+
+ <sect2 xml:id="language.types.object.init">
+ <title>Inizializzazione di un object</title>
+
+ <para>
+ Per creare un nuovo <type>object</type>, utilizzare l'istruzione
<literal>new</literal>
+ per istanziare una classe:
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+class foo
+{
+ function do_foo()
+ {
+ echo "Doing foo.";
+ }
+}
+
+$bar = new foo;
+$bar->do_foo();
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <simpara>
+ Per una discussione completa, vedere il capitolo
+ <link linkend="language.oop5">Classi e Oggetti</link>.
+ </simpara>
+
+ </sect2>
+
+ <sect2 xml:id="language.types.object.casting">
+ <title>Conversione a object</title>
+
+ <para>
+ Se un <type>object</type> viene convertito in un altro
<type>object</type>, non subisce
+ modifiche. Se un valore di un qualsiasi altro tipo viene convertito ad
+ <type>object</type>, una nuova istanza della classe built-in
+ <literal>stdClass</literal> viene creata. Se il valore era &null;, la nuova
istanza sarà
+ vuota. Un <type>array</type> viene convertito in <type>object</type>
utilizzando i nomi
+ degli indici ed il loro corrispondente valore come attributi, fatta eccezione
+ per gli indici numerici, i quali saranno inaccessibili a meno che non vengano iterati.
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$obj = (object) array('1' => 'foo');
+var_dump(isset($obj->{'1'})); // outputs 'bool(false)'
+var_dump(key($obj)); // outputs 'int(1)'
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ <para>
+ Per ogni altro valore, una variabile di classe chiamata <literal>scalar</literal>
conterrà
+ quel valore.
+ </para>
+
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$obj = (object) 'ciao';
+echo $obj->scalar; // outputs 'ciao'
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ </sect2>
+</sect1>
+
+<!-- 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
+-->
Property changes on: phpdoc/it/trunk/language/types/object.xml
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision Date LastChangedDate LastChangedRevision Author LastChangedBy HeadURL URL
Added: svn:eol-style
+ native