<?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>Php code Optimization &#8211; Programming blog &#8211; website programming blog, blog on website programming .net, java , php and mor</title>
	<atom:link href="https://www.searchenginegenie.com/programming-blog/tag/php-code-optimization/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.searchenginegenie.com/programming-blog</link>
	<description></description>
	<lastBuildDate>Mon, 19 Jul 2010 17:54:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.5</generator>
	<item>
		<title>php code optimization tips</title>
		<link>https://www.searchenginegenie.com/programming-blog/php-code-optimization-tips/</link>
					<comments>https://www.searchenginegenie.com/programming-blog/php-code-optimization-tips/#respond</comments>
		
		<dc:creator><![CDATA[Camilla]]></dc:creator>
		<pubDate>Wed, 29 Oct 2008 14:14:00 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Php code Optimization]]></category>
		<guid isPermaLink="false">http://www.searchenginegenie.com/programming-blog/php-code-optimization-tips/</guid>

					<description><![CDATA[Do you know the ways to optimize your php code. Here we have some tips for you. If a method can be static, declare it as static. It will improve the Speed by a factor of 4. You should use echo as it is faster than print. If you have to concat string, Use echo&#8217;s [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Do you know the ways to optimize your php code. Here we have some tips for you.</p>
<ul>
<li>If a method can be static, declare it as static. It will improve the Speed by a factor of 4.</li>
<li>You should use echo as it is faster than print.</li>
<li>If you have to concat string, Use echo&#8217;s multiple parameters.</li>
<li>Set the value of how many times it should be iterated before the loop. Do not assign the value in the loop.</li>
<li>When a variable is no longer useful, unset those variables which will free memory.</li>
<li>Use absolute urls in includes and requires.</li>
<li>To get the time of when the script started its execution, you must prefer $_SERVER [&#8216;REQUEST_TIME&#8217;] than time ()</li>
<li>Str_replace is faster than preg_replace</li>
<li>It is much better to utilize switch statements than multi if, else if statements.</li>
<li>Every time close your database connections when you got all the datas from DB</li>
<li>Always use $row [&#8216;name&#8217;] to get data from DB.Because it is 7 times faster than $row [name]</li>
<li>Don&#8217;t use functions inside of for loop, such as for ($y=1; $y &lt;= main ($arr); $y) the main () function gets called each time.</li>
<li>If you declare a global variable and you are not using it in any function will slow down the performance because will check if the global exists or not.</li>
<li>Methods should be in derived classes. This will run faster than the method which was defined in the base class.</li>
<li>Surrounding your string by single quote (&#8216;) instead of double quotes (&#8220;) will be little faster as php looks for variables inside &#8220;&#8221; but not inside &#8221;.</li>
<li>A PHP script will be at least 2-10 times slower than a static HTML page by Apache. So it is better to use lot of static HTML pages with less scripts.</li>
<li>You must install a PHP caching product to naturally boost the performance by 25-100% by eliminating compile times. Your PHP scripts will be recompiled each time if the scripts are not cached.</li>
<li>Do not use OOP concepts too much because each method and object call consumes a lot of memory.</li>
<li>Split methods that has the code you will really re-use too much.Do not split all the functions.</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.searchenginegenie.com/programming-blog/php-code-optimization-tips/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: www.searchenginegenie.com @ 2024-08-21 00:17:11 by W3 Total Cache
-->