<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jontas &#187; static</title>
	<atom:link href="http://www.f15ijp.com/tag/static/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.f15ijp.com</link>
	<description>My digital notepad (notes etc)</description>
	<lastBuildDate>Wed, 28 Dec 2011 18:24:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PHP: Static functions in a Class</title>
		<link>http://www.f15ijp.com/2010/06/18/php-static-functions-in-a-class/</link>
		<comments>http://www.f15ijp.com/2010/06/18/php-static-functions-in-a-class/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 12:22:45 +0000</pubDate>
		<dc:creator>jontas</dc:creator>
				<category><![CDATA[PHP5]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[static]]></category>

		<guid isPermaLink="false">http://www.f15ijp.com/?p=510</guid>
		<description><![CDATA[Static functions can be used without instantiating the object. A quick example of a static function is shown below as well as a comparison with a non static function. A quick example of this (in PHP5): class TestClass&#123; static function staticFunction&#40;&#41;&#123; echo &#34;static function called&#34;; &#125; &#160; function nonStaticFunction&#40;&#41;&#123; echo &#34;nonstatic function was called&#34;; &#125; [...]]]></description>
			<content:encoded><![CDATA[<p>Static functions can be used without instantiating the object.</p>
<p>A quick example of a static function is shown below as well as a comparison with a non static function.</p>
<p>A quick example of this (in PHP5):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> TestClass<span style="color: #009900;">&#123;</span>
	static <span style="color: #000000; font-weight: bold;">function</span> staticFunction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;static function called&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> nonStaticFunction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;nonstatic function was called&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
TestClass<span style="color: #339933;">::</span><span style="color: #004000;">staticFunction</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//will echo static function called</span>
&nbsp;
<span style="color: #000088;">$testClass</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TestClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$testClass</span><span style="color: #339933;">.</span>nonStaticFunction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//will echo nonstatic function was called</span>
<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$testClass</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.f15ijp.com/2010/06/18/php-static-functions-in-a-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

