goba            Sat Nov  9 08:50:37 2002 EDT

  Modified files:              
    /phpdoc/en/language types.xml 
  Log:
  Adding info on conversion to objects and resources,
  removed these info from the juggling part
  
  
Index: phpdoc/en/language/types.xml
diff -u phpdoc/en/language/types.xml:1.96 phpdoc/en/language/types.xml:1.97
--- phpdoc/en/language/types.xml:1.96   Wed Nov  6 02:22:16 2002
+++ phpdoc/en/language/types.xml        Sat Nov  9 08:50:36 2002
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.96 $ -->
+<!-- $Revision: 1.97 $ -->
  <chapter id="language.types">
   <title>Types</title>
 
@@ -1729,8 +1729,27 @@
      For a full discussion, please read the section <link
      linkend="language.oop">Classes and Objects</link>.
     </simpara>
-
    </sect2>
+   
+   <sect2 id="language.types.object.casting">
+    <title>Converting to object</title>
+    
+    <para>
+     If an object is converted to an object, it is not modified. If a value
+     of any other type is converted to an object, a new instace of the
+     <literal>stdClass</literal> built in class is created. If the value
+     was null, the new instance will be empty. For any other value, a
+     member variable named <literal>scalar</literal> will contain the
+     value.
+     <informalexample>
+      <programlisting role="php">
+$obj = (object) 'ciao';
+echo $obj-&gt;scalar;  // outputs 'ciao'
+      </programlisting>
+     </informalexample>
+    </para>
+   </sect2>
+   
   </sect1>
 
   <sect1 id="language.types.resource">
@@ -1743,7 +1762,6 @@
      See the <link linkend="resource">appendix</link> 
      for a listing of all these
      functions and the corresponding resource types.
-     
     </para>
     
     <note>
@@ -1752,6 +1770,16 @@
      </simpara>
     </note>
 
+   <sect2 id="language.types.resource.casting">
+    <title>Converting to resource</title>
+    
+    <para>
+     As resource types hold special handlers to opened
+     files, database connections, image canvas areas and
+     the like, you cannot convert any value to a resource.
+    </para>
+   </sect2>
+
     <sect2 id="language.types.resource.self-destruct">
      <title>Freeing resources</title>
     
@@ -1767,11 +1795,11 @@
      function.
      <note>
       <simpara>
-       Persistent database-links are special, they 
+       Persistent database links are special, they 
        are <emphasis>not</emphasis> destroyed by the 
-       gc. See also <link 
+       garbage collector. See also the section about <link 
        linkend="features.persistent-connections">persistent 
-       links</link>
+       connections</link>.
       </simpara>
      </note>
     </para>
@@ -1817,8 +1845,7 @@
     <title>Syntax</title>
     <para>
      There is only one value of type &null;, and that is 
-     the case-insensitive keyword
-     &null;.
+     the case-insensitive keyword &null;.
      <informalexample>
       <programlisting role="php">
 $var = NULL;       
@@ -2119,7 +2146,6 @@
        <simpara><link linkend="language.types.array.casting">Converting to 
         array</link></simpara>
       </listitem>
-      <!-- don't exist yet
       <listitem>
        <simpara><link linkend="language.types.object.casting">Converting to 
         object</link></simpara>
@@ -2128,28 +2154,14 @@
        <simpara><link linkend="language.types.resource.casting">Converting to 
         resource</link></simpara>
       </listitem>
+      <!-- don't exist yet
       <listitem>
        <simpara><link linkend="language.types.null.casting">Converting to 
         &null;</link></simpara>
       </listitem>
       -->
      </itemizedlist>
-    
-    </para>
-    <para>
-     <!-- TODO: move to 'converting to object' -->
-     When casting from a scalar or a string variable to an object, the
-     variable will become an attribute of the object; the attribute
-     name will be 'scalar':
-     <informalexample>
-      <programlisting role="php">
-$var = 'ciao';
-$obj = (object) $var;
-echo $obj-&gt;scalar;  // outputs 'ciao'
-      </programlisting>
-     </informalexample>
     </para>
-
    </sect2>
   </sect1>
 



-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to