<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP5 Abstraction for the Rest of Us</title>
	<atom:link href="http://www.thewebsqueeze.com/web-design-tutorials/php5-abstraction-for-the-rest-of-us.html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thewebsqueeze.com/web-design-tutorials/php5-abstraction-for-the-rest-of-us.html</link>
	<description>Web Design Magazine</description>
	<lastBuildDate>Wed, 06 Jul 2011 03:12:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: CSS Gallery</title>
		<link>http://www.thewebsqueeze.com/web-design-tutorials/php5-abstraction-for-the-rest-of-us.html/comment-page-2/#comment-8082</link>
		<dc:creator>CSS Gallery</dc:creator>
		<pubDate>Fri, 15 Jan 2010 03:26:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.thewebsqueeze.com/?p=1743#comment-8082</guid>
		<description>Great introduction to OOP in PHP, well worth the read!</description>
		<content:encoded><![CDATA[<p>Great introduction to OOP in PHP, well worth the read!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Dingle</title>
		<link>http://www.thewebsqueeze.com/web-design-tutorials/php5-abstraction-for-the-rest-of-us.html/comment-page-1/#comment-7741</link>
		<dc:creator>Luke Dingle</dc:creator>
		<pubDate>Tue, 27 Oct 2009 21:59:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.thewebsqueeze.com/?p=1743#comment-7741</guid>
		<description>&lt;p&gt;Hi Alberto,&lt;/p&gt;

&lt;p&gt;There are ways to dynamically add methods to an object at runtime but you would need to have a very strong case for doing so. If the fingerprint of the class is going to change at runtime then you may not be looking at OOP in the correct way.&lt;/p&gt;

&lt;p&gt;In PHP 5.3, Lambda functions (and closures) are being introduced which allow creation of functions at runtime with a syntax much more similar to that seen in other languages. It has been possible to do this previously but you have to use the clunky create&#095;function.  There is a great overview of this new implementation at http://fabien.potencier.org/article/17/on-php-5-3-lambda-functions-and-closures&lt;/p&gt;

&lt;p&gt;I must point out that the original draft for Lambda functions in PHP specifically said &quot;This is not intended as a way to dynamically add methods to objects&quot;&lt;/p&gt;

&lt;p&gt;If you define a class yourself, there is a way to add functions dynamically, a great tutorial can be seen &lt;a href=&quot;http://www.gen-x-design.com/archives/dynamically-add-functions-to-php-classes/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you&#039;re bound to using the standard class (stdclass), you probably won&#039;t be able to do what you want. An instance of the stdclass isn&#039;t much more than an array with different syntax.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Hi Alberto,</p>
<p>There are ways to dynamically add methods to an object at runtime but you would need to have a very strong case for doing so. If the fingerprint of the class is going to change at runtime then you may not be looking at OOP in the correct way.</p>
<p>In PHP 5.3, Lambda functions (and closures) are being introduced which allow creation of functions at runtime with a syntax much more similar to that seen in other languages. It has been possible to do this previously but you have to use the clunky create&#95;function.  There is a great overview of this new implementation at <a href="http://fabien.potencier.org/article/17/on-php-5-3-lambda-functions-and-closures" rel="nofollow">http://fabien.potencier.org/article/17/on-php-5-3-lambda-functions-and-closures</a></p>
<p>I must point out that the original draft for Lambda functions in PHP specifically said &#8220;This is not intended as a way to dynamically add methods to objects&#8221;</p>
<p>If you define a class yourself, there is a way to add functions dynamically, a great tutorial can be seen <a href="http://www.gen-x-design.com/archives/dynamically-add-functions-to-php-classes/" rel="nofollow">here</a>.</p>
<p>If you&#8217;re bound to using the standard class (stdclass), you probably won&#8217;t be able to do what you want. An instance of the stdclass isn&#8217;t much more than an array with different syntax.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alberto</title>
		<link>http://www.thewebsqueeze.com/web-design-tutorials/php5-abstraction-for-the-rest-of-us.html/comment-page-1/#comment-7740</link>
		<dc:creator>Alberto</dc:creator>
		<pubDate>Tue, 27 Oct 2009 14:29:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.thewebsqueeze.com/?p=1743#comment-7740</guid>
		<description>I mean :

function fun1 (){
echo “Im fine”;
}

myObject-&gt;myMethod = fun1; //doesnt work

thanks</description>
		<content:encoded><![CDATA[<p>I mean :</p>
<p>function fun1 (){<br />
echo “Im fine”;<br />
}</p>
<p>myObject-&gt;myMethod = fun1; //doesnt work</p>
<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alberto</title>
		<link>http://www.thewebsqueeze.com/web-design-tutorials/php5-abstraction-for-the-rest-of-us.html/comment-page-1/#comment-7739</link>
		<dc:creator>Alberto</dc:creator>
		<pubDate>Tue, 27 Oct 2009 14:17:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.thewebsqueeze.com/?p=1743#comment-7739</guid>
		<description>Hello. Good tutorial. Thanks.
Need a help.
If I want to create an object with generic standard class, I can do :

$myObject = new stdClass();

I can set a data member (property) as :

$myObject-&gt;myProperty = &#039;hello world&#039;;

how can I set a method?

Thanks.
Alberto

note
the instinct way doesnt work.

function fun1 (){
  echo &quot;Im fine&quot;;
}

myObject-&gt;fun1; //doesnt work</description>
		<content:encoded><![CDATA[<p>Hello. Good tutorial. Thanks.<br />
Need a help.<br />
If I want to create an object with generic standard class, I can do :</p>
<p>$myObject = new stdClass();</p>
<p>I can set a data member (property) as :</p>
<p>$myObject-&gt;myProperty = &#8216;hello world&#8217;;</p>
<p>how can I set a method?</p>
<p>Thanks.<br />
Alberto</p>
<p>note<br />
the instinct way doesnt work.</p>
<p>function fun1 (){<br />
  echo &#8220;Im fine&#8221;;<br />
}</p>
<p>myObject-&gt;fun1; //doesnt work</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cc</title>
		<link>http://www.thewebsqueeze.com/web-design-tutorials/php5-abstraction-for-the-rest-of-us.html/comment-page-1/#comment-7234</link>
		<dc:creator>cc</dc:creator>
		<pubDate>Tue, 01 Sep 2009 21:22:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.thewebsqueeze.com/?p=1743#comment-7234</guid>
		<description>Hey there. Just thought I&#039;d say thanks for giving a rundown on this topic. Brings back memories of my Java days. Look forward to more on this topic in the future.</description>
		<content:encoded><![CDATA[<p>Hey there. Just thought I&#8217;d say thanks for giving a rundown on this topic. Brings back memories of my Java days. Look forward to more on this topic in the future.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andres</title>
		<link>http://www.thewebsqueeze.com/web-design-tutorials/php5-abstraction-for-the-rest-of-us.html/comment-page-1/#comment-5302</link>
		<dc:creator>Andres</dc:creator>
		<pubDate>Fri, 03 Jul 2009 18:23:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.thewebsqueeze.com/?p=1743#comment-5302</guid>
		<description>hi, excellent article,I&#039;m asp.net programmer and I&#039;m so far beginning with PHP, I see that the new OOP features are excellent, as I am a bit confused with the syntax, but it is normal, very good article!</description>
		<content:encoded><![CDATA[<p>hi, excellent article,I&#8217;m asp.net programmer and I&#8217;m so far beginning with PHP, I see that the new OOP features are excellent, as I am a bit confused with the syntax, but it is normal, very good article!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Dingle</title>
		<link>http://www.thewebsqueeze.com/web-design-tutorials/php5-abstraction-for-the-rest-of-us.html/comment-page-1/#comment-5265</link>
		<dc:creator>Luke Dingle</dc:creator>
		<pubDate>Mon, 01 Jun 2009 13:31:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.thewebsqueeze.com/?p=1743#comment-5265</guid>
		<description>&lt;p&gt;Hi Student,&lt;/p&gt;

&lt;p&gt;Sometimes these code syntax highlighters can insert strange characters. Can you explain exactly where it&#039;s going wrong and I may be able to help. &lt;/p&gt;

&lt;p&gt;I&#039;ll try find time to zip up a copy too if I can.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Hi Student,</p>
<p>Sometimes these code syntax highlighters can insert strange characters. Can you explain exactly where it&#8217;s going wrong and I may be able to help. </p>
<p>I&#8217;ll try find time to zip up a copy too if I can.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

