didou Thu Jul 3 07:26:07 2003 EDT
Modified files:
/phpdoc/en/reference/classobj/functions get-class.xml
get-parent-class.xml
Log:
adding examples and WS
Index: phpdoc/en/reference/classobj/functions/get-class.xml
diff -u phpdoc/en/reference/classobj/functions/get-class.xml:1.2
phpdoc/en/reference/classobj/functions/get-class.xml:1.3
--- phpdoc/en/reference/classobj/functions/get-class.xml:1.2 Wed Apr 17 02:36:42
2002
+++ phpdoc/en/reference/classobj/functions/get-class.xml Thu Jul 3 07:26:06
2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.4 -->
<refentry id="function.get-class">
<refnamediv>
@@ -24,11 +24,51 @@
in its original notation.
</simpara>
</note>
- <simpara>
+ <para>
+ <example>
+ <title>Using <function>get_class</function></title>
+ <programlisting>
+<![CDATA[
+<?php
+
+class foo {
+ function foo() {
+ // implements some logic
+ }
+
+ function name() {
+ echo "My name is " , get_class($this) , "\n";
+ }
+}
+
+// create an object
+$bar = new foo();
+
+// external call
+echo "Its name is " , get_class($bar) , "\n";
+
+// internal call
+$bar->name();
+
+?>
+]]>
+ </programlisting>
+ <para>
+ The output is:
+ </para>
+ <screen>
+<![CDATA[
+Its name is foo
+My name is foo
+]]>
+ </screen>
+ </example>
+ </para>
+ <para>
See also <function>get_parent_class</function>,
<function>gettype</function>, and
<function>is_subclass_of</function>.
- </simpara>
+ </para>
</refsect1>
</refentry>
Index: phpdoc/en/reference/classobj/functions/get-parent-class.xml
diff -u phpdoc/en/reference/classobj/functions/get-parent-class.xml:1.2
phpdoc/en/reference/classobj/functions/get-parent-class.xml:1.3
--- phpdoc/en/reference/classobj/functions/get-parent-class.xml:1.2 Wed Apr 17
02:36:43 2002
+++ phpdoc/en/reference/classobj/functions/get-parent-class.xml Thu Jul 3 07:26:06
2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/classobj.xml, last change in rev 1.4 -->
<refentry id="function.get-parent-class">
<refnamediv>
@@ -22,10 +22,52 @@
class of the class with that name. This functionality was added in PHP
4.0.5.
</para>
- <simpara>
+ <para>
+ <example>
+ <title>Using <function>get_parent_class</function></title>
+ <programlisting>
+<![CDATA[
+<?php
+
+class dad {
+ function dad() {
+ // implements some logic
+ }
+}
+
+class child extends dad {
+ function child() {
+ echo "I'm " , get_parent_class($this) , "'s son\n";
+ }
+}
+
+class child2 extends dad {
+ function child2() {
+ echo "I'm " , get_parent_class('child2') , "'s son too\n";
+ }
+}
+
+$foo = new child();
+$bar = new child2();
+
+?>
+]]>
+ </programlisting>
+ <para>
+ The output is:
+ </para>
+ <screen>
+<![CDATA[
+I'm dad's son
+I'm dad's son too
+]]>
+ </screen>
+ </example>
+ </para>
+ <para>
See also <function>get_class</function> and
- <function>is_subclass_of</function>
- </simpara>
+ <function>is_subclass_of</function>.
+ </para>
</refsect1>
</refentry>
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php