<?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>FlashBannerOnline &#187; PHP</title>
	<atom:link href="http://blog.flashbanneronline.com/category/tutorials/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flashbanneronline.com</link>
	<description>Online Flash Banner Generator blog!</description>
	<lastBuildDate>Sun, 26 Jun 2011 11:38:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>optimize PHP code performances</title>
		<link>http://blog.flashbanneronline.com/2011/06/optimize-php-code-performances/</link>
		<comments>http://blog.flashbanneronline.com/2011/06/optimize-php-code-performances/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 20:57:21 +0000</pubDate>
		<dc:creator>Behrouz Pooladrag</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[banner online "banner online"]]></category>

		<guid isPermaLink="false">http://blog.flashbanneronline.com/?p=557</guid>
		<description><![CDATA[If a method can be static, declare it static. Speed improvement is by a factor of 4. echo is faster than print.(* compare with list from phplens by John Lim) Use echo’s multiple parameters instead of string concatenation. Set the maxvalue for your for-loops before and not in the loop. Unset your variables to free [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li>If a method can be static, declare it static. Speed improvement is by a factor of 4.</li>
<li>echo is faster than print.(<em>* compare with list from phplens by John Lim</em>)</li>
<li>Use echo’s multiple parameters instead of string concatenation.</li>
<li>Set the maxvalue for your for-loops before and not in the loop.</li>
<li>Unset your variables to free memory, especially large arrays.</li>
<li>Avoid magic like __get, __set, __autoload</li>
<li>require_once() is expensive</li>
<li>Use full paths in includes and requires, less time spent on resolving the OS paths.</li>
<li>If you need to find out the time when the script started executing, $_SERVER[’REQUEST_TIME’] is preferred to time()</li>
<li>See if you can use strncasecmp, strpbrk and stripos instead of regex</li>
<li>str_replace is faster than preg_replace, but strtr is faster than str_replace by a factor of 4</li>
<li>If the function, such as string replacement function, accepts both  arrays and single characters as arguments, and if your argument list is  not too long, consider writing a few redundant replacement statements,  passing one character at a time, instead of one line of code that  accepts arrays as search and replace arguments.</li>
<li>It’s better to use select statements than multi if, else if, statements.</li>
<li>Error suppression with @ is very slow.</li>
<li>Turn on apache’s mod_deflate</li>
<li>Close your database connections when you’re done with them</li>
<li>$row[’id’] is 7 times faster than $row[id]</li>
<li>Error messages are expensive</li>
<li>Do not use functions inside of for loop, such as for ($x=0; $x &lt;  count($array); $x) The count() function gets called each time.</li>
<li>Incrementing a local variable in a method is the fastest. Nearly the same as calling a local variable in a function.</li>
<li>Incrementing a global variable is 2 times slow than a local var.</li>
<li>Incrementing an object property (eg. $this-&gt;prop++) is 3 times slower than a local variable.</li>
<li>Incrementing an undefined local variable is 9-10 times slower than a pre-initialized one.</li>
<li>Just declaring a global variable without using it in a function also  slows things down (by about the same amount as incrementing a local  var). PHP probably does a check to see if the global exists.</li>
<li>Method invocation appears to be independent of the number of methods  defined in the class because I added 10 more methods to the test class  (before and after the test method) with no change in performance.</li>
<li>Methods in derived classes run faster than ones defined in the base class.</li>
<li>A function call with one parameter and an empty function body takes  about the same time as doing 7-8 $localvar++ operations. A similar  method call is of course about 15 $localvar++ operations.</li>
<li>Surrounding your string by ‘ instead of ” will make things interpret  a little faster since php looks for variables inside “…” but not inside  ‘…’. Of course you can only do this when you don’t need to have  variables in the string.</li>
<li>When echoing strings it’s faster to separate them by comma instead  of dot. Note: This only works with echo, which is a function that can  take several strings as arguments.</li>
<li>A PHP script will be served at least 2-10 times slower than a static  HTML page by Apache. Try to use more static HTML pages and fewer  scripts.</li>
<li>Your PHP scripts are recompiled every time unless the scripts are  cached. Install a PHP caching product to typically increase performance  by 25-100% by removing compile times.</li>
<li>Cache as much as possible. Use memcached – memcached is a  high-performance memory object caching system intended to speed up  dynamic web applications by alleviating database load. OP code caches  are useful so that your script does not have to be compiled on every  request</li>
<li>When working with strings and you need to check that the string is  either of a certain length you’d understandably would want to use the  strlen() function. This function is pretty quick since it’s operation  does not perform any calculation but merely return the already known  length of a string available in the zval structure (internal C struct  used to store variables in PHP). However because strlen() is a function  it is still somewhat slow because the function call requires several  operations such as lowercase &amp; hashtable lookup followed by the  execution of said function. In some instance you can improve the speed  of your code by using an isset() trick.</li>
</ul>
<p><strong>Ex.</strong></p>
<pre class="brush: php; title: ; notranslate">
if (strlen($foo) &lt; 5) { echo &quot;Foo is too short&quot;; }
</pre>
<p><strong>vs.</strong></p>
<pre class="brush: php; title: ; notranslate">
if (!isset($foo{5})) { echo &quot;Foo is too short&quot;; }
</pre>
<ul>
<li>Calling isset() happens to be faster then strlen() because  unlike strlen(), isset() is a language construct and not a function  meaning that it’s execution does not require function lookups and  lowercase. This means you have virtually no overhead on top of the  actual code that determines the string’s length.</li>
<li>When incrementing or decrementing the value of the variable $i++  happens to be a tad slower then ++$i. This is something PHP specific and  does not apply to other languages, so don’t go modifying your C or Java  code thinking it’ll suddenly become faster, it won’t. ++$i happens to  be faster in PHP because instead of 4 opcodes used for $i++ you only  need 3. Post incrementation actually causes in the creation of a  temporary var that is then incremented. While pre-incrementation  increases the original value directly. This is one of the optimization  that opcode optimized like Zend’s PHP optimizer. It is a still a good  idea to keep in mind since not all opcode optimizers perform this  optimization and there are plenty of ISPs and servers running without an  opcode optimizer.</li>
<li>Not everything has to be OOP, often it is too much overhead, each method and object call consumes a lot of memory.</li>
<li>Do not implement every data structure as a class, arrays are useful, too</li>
<li>Don’t split methods too much, think, which code you will really re-use</li>
<li>You can always split the code of a method later, when needed</li>
<li>Make use of the countless predefined functions</li>
<li>If you have very time consuming functions in your code, consider writing them as C extensions</li>
<li>Profile your code. A profiler shows you, which parts of your code  consumes how many time. The Xdebug debugger already contains a profiler.  Profiling shows you the bottlenecks in overview</li>
<li>mod_gzip which is available as an Apache module compresses your data on the fly and can reduce the data to transfer up to 80%</li>
<li><a rel="external,nofollow" href="http://phplens.com/lens/php-book/optimizing-debugging-php.php" target="_blank">Excellent Article</a> about optimizing php by John Lim</li>
</ul>
<p>As Reihold Webber pointed to a post from <a rel="external,nofollow" href="http://phplens.com/lens/php-book/optimizing-debugging-php.php" target="_blank">John Lim</a> (found this article copied without state the source <a rel="external,nofollow" href="http://www.whenpenguinsattack.com/2006/07/21/optimizing-object-oriented-php" target="_blank">here</a>),  then i investigate further and truly that is an excellent best practice  tutorial for optimizing the php code performance, covered almost all  aspects from low level webserver configuration, PHP configuration,  coding styling, and performace comparisson as well.</p>
<p>Another good practice for better php performance as written in <a rel="external,nofollow" href="http://www.cluesheet.com/" target="_blank">cluesheet.com</a> are:</p>
<ul>
<li>Do use single quotes over double quotes.</li>
<li>Do use switch over lots of if statements</li>
<li>Do avoid testing loop conditionals with function tests every iteration eg. for($i=0;i&lt;=count($x);$i++){…</li>
<li>Do use foreach for looping collections/arrays. PHP4 items are byval, greater than PHP5 items are byref</li>
<li>Do consider using the Singleton Method when creating complex PHP classes.</li>
<li>Do use POST over GET for all values that will wind up in the database for TCP/IP packet performance reasons.</li>
<li>Do use ctype_alnum,ctype_alpha and ctype_digit over regular expression to test form value types for performance reasons.</li>
<li>Do use full file paths in production environment over  basename/fileexists/open_basedir to avoid performance hits for the  filesystem having to hunt through the file path. Once determined,  serialize and/or cache path values in a $_SETTINGS array.  $_SETTINGS["cwd"]=cwd(./);</li>
<li>Do use require/include over require_once/include_once to ensure proper opcode caching.</li>
<li>Do use tmpfile or tempnam for creating temp files/filenames</li>
<li>Do use a proxy to access web services (XML or JSOM) on foreign  domains using XMLHTTP to avoid cross-domain errors. eg.  foo.com&lt;–&gt;XMLHTTP&lt;–&gt;bar.com</li>
<li>Do use error_reporting (E_ALL); during debug.</li>
<li>Do set Apache allowoverride to “none” to improve Apache performance in accessing files/directories.</li>
<li>Do use a fast fileserver for serving static content (thttpd). static.mydomain.com, dynamic.mydomain.com</li>
<li>Do serialize application settings like paths into an associative array and cache or serialize that array after first execution.</li>
<li>Do use PHP output control buffering for page caching of heavilty accessed pages</li>
<li>Do use PDO prepare over native db prepare for statements. mysql_attr_direct_query=&gt;1</li>
<li>Do NOT use SQL wildcard select. eg. SELECT *</li>
<li>Do use database logic (queries, joins, views, procedures) over loopy PHP.</li>
<li>Do use shortcut syntax for SQL insers if not using PDO parameters  parameters. eg. INSERT INTO MYTABLE (FIELD1,FIELD2) VALUES  ((“x”,”y”),(“p”,”q”));</li>
</ul>
<p>Another Interesting articles about optimizing php performance:</p>
<ul>
<li><a rel="external,nofollow" href="http://www.mysqlperformanceblog.com/2006/08/09/cache-performance-comparison/" target="_blank">PHP &amp; Mysql Cache Performance Comparison</a></li>
<li><a rel="external,nofollow" href="http://talks.php.net/show/acc_php" target="_blank">Accelerating PHP Applications</a> Slide presentation International PHP Conference 2004</li>
<li><a rel="external,nofollow" href="http://www.ilovejackdaniels.com/php/caching-output-in-php/" target="_blank">Caching output in PHP</a></li>
</ul>
<p><a href="http://www.chazzuka.com/63-best-practice-to-optimize-php-code-performances-58/" target="_blank">source </a></p>
<div id="_mcePaste" class="mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;"><!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves /> <w:TrackFormatting /> <w:PunctuationKerning /> <w:ValidateAgainstSchemas /> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF /> <w:LidThemeOther>EN-US</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>AR-SA</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables /> <w:SnapToGridInCell /> <w:WrapTextWithPunct /> <w:UseAsianBreakRules /> <w:DontGrowAutofit /> <w:SplitPgBreakAndParaMark /> <w:DontVertAlignCellWithSp /> <w:DontBreakConstrainedForcedTables /> <w:DontVertAlignInTxbx /> <w:Word11KerningPairs /> <w:CachedColBalance /> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math" /> <m:brkBin m:val="before" /> <m:brkBinSub m:val="&#45;-" /> <m:smallFrac m:val="off" /> <m:dispDef /> <m:lMargin m:val="0" /> <m:rMargin m:val="0" /> <m:defJc m:val="centerGroup" /> <m:wrapIndent m:val="1440" /> <m:intLim m:val="subSup" /> <m:naryLim m:val="undOvr" /> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"   DefSemiHidden="true" DefQFormat="false" DefPriority="99"   LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Normal" /> <w:LsdException Locked="false" Priority="9" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="heading 1" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /> <w:LsdException Locked="false" Priority="39" Name="toc 1" /> <w:LsdException Locked="false" Priority="39" Name="toc 2" /> <w:LsdException Locked="false" Priority="39" Name="toc 3" /> <w:LsdException Locked="false" Priority="39" Name="toc 4" /> <w:LsdException Locked="false" Priority="39" Name="toc 5" /> <w:LsdException Locked="false" Priority="39" Name="toc 6" /> <w:LsdException Locked="false" Priority="39" Name="toc 7" /> <w:LsdException Locked="false" Priority="39" Name="toc 8" /> <w:LsdException Locked="false" Priority="39" Name="toc 9" /> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /> <w:LsdException Locked="false" Priority="10" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Title" /> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /> <w:LsdException Locked="false" Priority="11" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /> <w:LsdException Locked="false" Priority="22" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Strong" /> <w:LsdException Locked="false" Priority="20" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /> <w:LsdException Locked="false" Priority="59" SemiHidden="false"    UnhideWhenUsed="false" Name="Table Grid" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /> <w:LsdException Locked="false" Priority="1" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 1" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 1" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 1" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /> <w:LsdException Locked="false" Priority="34" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /> <w:LsdException Locked="false" Priority="29" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Quote" /> <w:LsdException Locked="false" Priority="30" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 1" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 1" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 2" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 2" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 2" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 2" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 2" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 3" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 3" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 3" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 3" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 3" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 4" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 4" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 4" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 4" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 4" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 5" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 5" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 5" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 5" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 5" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /> <w:LsdException Locked="false" Priority="60" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Shading Accent 6" /> <w:LsdException Locked="false" Priority="61" SemiHidden="false"    UnhideWhenUsed="false" Name="Light List Accent 6" /> <w:LsdException Locked="false" Priority="62" SemiHidden="false"    UnhideWhenUsed="false" Name="Light Grid Accent 6" /> <w:LsdException Locked="false" Priority="63" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /> <w:LsdException Locked="false" Priority="64" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /> <w:LsdException Locked="false" Priority="65" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /> <w:LsdException Locked="false" Priority="66" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /> <w:LsdException Locked="false" Priority="67" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /> <w:LsdException Locked="false" Priority="68" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /> <w:LsdException Locked="false" Priority="69" SemiHidden="false"    UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /> <w:LsdException Locked="false" Priority="70" SemiHidden="false"    UnhideWhenUsed="false" Name="Dark List Accent 6" /> <w:LsdException Locked="false" Priority="71" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /> <w:LsdException Locked="false" Priority="72" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful List Accent 6" /> <w:LsdException Locked="false" Priority="73" SemiHidden="false"    UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /> <w:LsdException Locked="false" Priority="19" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /> <w:LsdException Locked="false" Priority="21" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /> <w:LsdException Locked="false" Priority="31" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /> <w:LsdException Locked="false" Priority="32" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /> <w:LsdException Locked="false" Priority="33" SemiHidden="false"    UnhideWhenUsed="false" QFormat="true" Name="Book Title" /> <w:LsdException Locked="false" Priority="37" Name="Bibliography" /> <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <mce:style><!   /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0cm 5.4pt 0cm 5.4pt; 	mso-para-margin-top:0cm; 	mso-para-margin-right:0cm; 	mso-para-margin-bottom:10.0pt; 	mso-para-margin-left:0cm; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:Arial; 	mso-bidi-theme-font:minor-bidi;} --> <!--[endif] -->&nbsp;</p>
<p class="MsoNormal" style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; line-height: normal; mso-outline-level: 1;"><strong><span style="font-size: 24.0pt; font-family: &quot;Times New Roman&quot;,&quot;serif&quot;; mso-fareast-font-family: &quot;Times New Roman&quot;; mso-font-kerning: 18.0pt;">optimize PHP code performances</span></strong></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.flashbanneronline.com/2011/06/optimize-php-code-performances/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SimpleXML Class in PHP 5</title>
		<link>http://blog.flashbanneronline.com/2010/09/simplexml-class-in-php-5/</link>
		<comments>http://blog.flashbanneronline.com/2010/09/simplexml-class-in-php-5/#comments</comments>
		<pubDate>Sun, 05 Sep 2010 13:18:54 +0000</pubDate>
		<dc:creator>Behrouz Pooladrag</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[as3.0 drop object]]></category>
		<category><![CDATA[as3.0 external php variables]]></category>
		<category><![CDATA[inline xml flash]]></category>
		<category><![CDATA[PHP 5]]></category>
		<category><![CDATA[php simple xml parse]]></category>
		<category><![CDATA[SimpleXML]]></category>
		<category><![CDATA[simplexmlelement online]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[xml to php 5 class]]></category>

		<guid isPermaLink="false">http://blog.flashbanneronline.com/?p=367</guid>
		<description><![CDATA[the full XML Parser class was used, which requires tons of lines of code and extra time. In PHP5, we can use the Simple XML class to quickly parse XML in as few as two lines of code. Our Extensible Markup Language Text I&#8217;m using the same text as Jubba&#8217;s XML Parsing tutorials, except I [...]]]></description>
			<content:encoded><![CDATA[<p>the full XML  Parser class was used, which requires tons of lines of code and extra time. In PHP5, we can use the Simple XML class to  quickly parse XML in as few as two lines of code.</p>
<p>Our Extensible Markup Language Text<br />
I&#8217;m using the same text as Jubba&#8217;s XML Parsing tutorials, except I might add some attributes to show you the extra  power of Simple XML:﻿</p>
<pre class="brush: xml; title: ; notranslate">

&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;news&gt;
 &lt;story&gt;
 &lt;headline&gt; Godzilla Attacks LA! &lt;/headline&gt;
 &lt;description&gt;Equipped with a Japanese Mind-control device, the giant monster has attacked important harbours along the California coast. President to take action. &lt;/description&gt;
 &lt;/story&gt;
 &lt;story&gt;
 &lt;headline&gt; Bigfoot Spotted at M.I.T. Dining Area &lt;/headline&gt;
 &lt;description&gt;The beast was seen ordering a Snapple in the dining area on Tuesday. In a related story, Kirupa Chinnathambi, an MIT engineering student has been reported missing. &lt;/description&gt;
 &lt;/story&gt;
 &lt;story&gt;
 &lt;headline&gt; London Angel Saves England &lt;/headline&gt;
 &lt;description&gt;The &quot;London Angel&quot; known only as &quot;Kit&quot; has saved the U.K. yet again. Reports have stated that she destroyed every single Churchill bobble-head dog in the country. A great heartfilled thank you goes out to her. &lt;/description&gt;
 &lt;/story&gt;
 &lt;story&gt;
 &lt;headline&gt; Six-eyed Man to be Wed to an Eight-armed Woman &lt;/headline&gt;
 &lt;description&gt;Uhhhmmm... No comment really... just a little creepy to see them together... &lt;/description&gt;
 &lt;/story&gt;
 &lt;story&gt;
 &lt;headline&gt; Ahmed's Birthday Extravaganza! &lt;/headline&gt;
 &lt;description&gt;The gifted youngster's birthday party should be a blast. He is turning thirteen and has requested a large cake, ice cream, and a petting zoo complete with pony rides. &lt;/description&gt;
 &lt;/story&gt;
&lt;/news&gt;
</pre>
<p>Our PHP Code<br />
I know you&#8217;re expecting a couple hundred or so lines of  					advanced PHP with impossible to understand comments. You&#8217;re  					wrong, here&#8217;s the two lines you need to get a Simple XML  					object:</p>
<pre class="brush: php; title: ; notranslate">

//Since we're already using PHP5, why don't we exploit their easy to use file_get_contents() command?
$xmlFileData = file_get_contents(“input.xml”);
//Here's our Simple XML parser!
$xmlData = new SimpleXMLElement($xmlFileData);
//And here's the output.
print_r($xmlData);
</pre>
<p>Execute that on your PHP server, and you get some  					meaningless gibberish like the following.</p>
<pre class="brush: php; title: ; notranslate">

SimpleXMLElement Object (
 [story] =&gt; Array (
 [0] =&gt; SimpleXMLElement Object (
 [headline] =&gt; Godzilla Attacks LA!
 [description] =&gt; Equipped with a Japanese Mind-control device, the giant monster has attacked important harbours along the California coast. President to take action.
 )
 [1] =&gt; SimpleXMLElement Object (
 [headline] =&gt; Bigfoot Spotted at M.I.T. Dining Area
 [description] =&gt; The beast was seen ordering a Snapple in the dining area on Tuesday. In a related story, Kirupa Chinnathambi, an MIT engineering student has been reported missing.
 )
 [2] =&gt; SimpleXMLElement Object (
 [headline] =&gt; London Angel Saves England
 [description] =&gt; The &quot;London Angel&quot; known only as &quot;Kit&quot; has saved the U.K. yet again. Reports have stated that she destroyed every single Churchill bobble-head dog in the country. A great heartfilled thank you goes out to her.
 )
 [3] =&gt; SimpleXMLElement Object (
 [headline] =&gt; Six-eyed Man to be Wed to an Eight-armed Woman
 [description] =&gt; Uhhhmmm... No comment really... just a little creepy to see them together...
 )
 [4] =&gt; SimpleXMLElement Object (
 [headline] =&gt; Ahmed's Birthday Extravaganza!
 [description] =&gt; The gifted youngster's birthday party should be a blast. He is turning thirteen and has requested a large cake, ice cream, and a petting zoo complete with pony rides.
 )
 )
 )
)
</pre>
<p>To actually get data from that jumble of values, we can access it as an array with a class applied to it. Like so:</p>
<pre class="brush: php; title: ; notranslate">
//Retrieving the headline from the first story
$xmlHeadline = $xmlData-&gt;story[0]-&gt;headline;
//Printing our first headline
print($xmlHeadline);
</pre>
<p>But what if you wanted the date of the story, but didn&#8217;t want to have to add another node to the story array? Just add an attribute. And Simple XML can also handle attributes! So our new XML looks like:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;news&gt;
 &lt;story&gt;
 &lt;headline date=”January 19, 2005”&gt; Godzilla Attacks LA! &lt;/headline&gt;
 &lt;description&gt;Equipped with a Japanese Mind-control device, the giant monster has attacked important harbours along the California coast. President to take action. &lt;/description&gt;
 &lt;/story&gt;
 &lt;story&gt;
 &lt;headline date=”February 14, 2006”&gt; Bigfoot Spotted at M.I.T. Dining Area &lt;/headline&gt;
 &lt;description&gt;The beast was seen ordering a Snapple in the dining area on Tuesday. In a related story, Kirupa Chinnathambi, an MIT engineering student has been reported missing. &lt;/description&gt;
 &lt;/story&gt;
 &lt;story&gt;
 &lt;headline date=”May 27, 2006”&gt; London Angel Saves England &lt;/headline&gt;
 &lt;description&gt;The &quot;London Angel&quot; known only as &quot;Kit&quot; has saved the U.K. yet again. Reports have stated that she destroyed every single Churchill bobble-head dog in the country. A great heartfilled thank you goes out to her. &lt;/description&gt;
 &lt;/story&gt;
 &lt;story&gt;
 &lt;headline date=”June 3, 2006”&gt; Six-eyed Man to be Wed to an Eight-armed Woman &lt;/headline&gt;
 &lt;description&gt;Uhhhmmm... No comment really... just a little creepy to see them together... &lt;/description&gt;
 &lt;/story&gt;
 &lt;story&gt;
 &lt;headline date=”July 28, 2006”&gt; Ahmed's Birthday Extravaganza! &lt;/headline&gt;
 &lt;description&gt;The gifted youngster's birthday party should be a blast. He is turning thirteen and has requested a large cake, ice cream, and a petting zoo complete with pony rides. &lt;/description&gt;
 &lt;/story&gt;
&lt;/news&gt;
</pre>
<p>So now we have all our news and their dates, but how do we show it to people? We can use a simple foreach loop to output everything to people.</p>
<pre class="brush: php; title: ; notranslate">

//Outputing all of our XML to people
foreach($xmlData-&gt;story as $story) {
 print(“&lt;h2&gt;” . $story-&gt;headline . “&lt;/h2&gt;&lt;br /&gt;”);
 print($story-&gt;description . “&lt;br /&gt;_________________________&lt;br /&gt;”);
 print($story-&gt;headline[&quot;date&quot;] . “&lt;br /&gt;&lt;br /&gt;”);

}
</pre>
<p>Of course the output doesn&#8217;t look very pretty, but you could  write some nice CSS or something to fix that! 		Remember, this only works in PHP5, so get PHP5, because it&#8217;s so much better than any other version of PHP!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flashbanneronline.com/2010/09/simplexml-class-in-php-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smart Sample Post PHP vars without form (cURL)</title>
		<link>http://blog.flashbanneronline.com/2009/10/smart-sample-post-php-vars-without-form-curl/</link>
		<comments>http://blog.flashbanneronline.com/2009/10/smart-sample-post-php-vars-without-form-curl/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 08:14:28 +0000</pubDate>
		<dc:creator>Behrouz Pooladrag</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[aweber custom form curl php]]></category>
		<category><![CDATA[cURL]]></category>
		<category><![CDATA[curl post aweber form]]></category>
		<category><![CDATA[curl_close]]></category>
		<category><![CDATA[curl_exec]]></category>
		<category><![CDATA[curl_init]]></category>
		<category><![CDATA[curl_setopt]]></category>
		<category><![CDATA[post php aweber]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.flashbanneronline.com/?p=155</guid>
		<description><![CDATA[Smart Sample Post PHP vars without form (cURL) You have to have cURL enabled. Take a look: &#60;?php $email = $_POST['email']; $ch = curl_init(&#8216;http://www.aweber.com/scripts/addlead.pl&#8217;); curl_setopt ($ch, CURLOPT_POST, 1); curl_setopt ($ch, CURLOPT_POSTFIELDS, &#8220;from=&#8221;.$email.&#8221;&#38;name=somename &#38;meta_web_form_id=1829234431&#38;meta_split_id=&#38;unit=rm101-sign-up &#38;redirect=http://www.aweber.com/form/thankyou_vo.html&#38; meta_redirect_onlist=&#38;meta_adtracking=&#38;meta_message=1 &#38;meta_required=from&#38;meta_forward_vars=0&#8243;); curl_exec ($ch); curl_close ($ch); ?&#62; oops , Finish]]></description>
			<content:encoded><![CDATA[<p>Smart Sample Post PHP vars without form (cURL)</p>
<p>You have to have <a href="http://bg2.php.net/curl">cURL</a> enabled.</p>
<p>Take a look:</p>
<div style="white-space: nowrap;">&lt;?php</p>
<p>$email = $_POST['email'];<br />
$ch = curl_init(&#8216;http://www.aweber.com/scripts/addlead.pl&#8217;);<br />
curl_setopt ($ch, CURLOPT_POST, 1);</p>
<p>curl_setopt ($ch, CURLOPT_POSTFIELDS, &#8220;from=&#8221;.$email.&#8221;&amp;name=somename<br />
&amp;meta_web_form_id=1829234431&amp;meta_split_id=&amp;unit=rm101-sign-up<br />
&amp;redirect=http://www.aweber.com/form/thankyou_vo.html&amp;<br />
meta_redirect_onlist=&amp;meta_adtracking=&amp;meta_message=1<br />
&amp;meta_required=from&amp;meta_forward_vars=0&#8243;);</p></div>
<div style="white-space: nowrap;">curl_exec ($ch);<br />
curl_close ($ch);</p>
<p>?&gt;</p></div>
<div style="white-space: nowrap;"><span>oops , Finish <img src='http://blog.flashbanneronline.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
</span></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.flashbanneronline.com/2009/10/smart-sample-post-php-vars-without-form-curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic Using the PHP Include Command</title>
		<link>http://blog.flashbanneronline.com/2009/10/basic-using-the-php-include-command/</link>
		<comments>http://blog.flashbanneronline.com/2009/10/basic-using-the-php-include-command/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 14:16:02 +0000</pubDate>
		<dc:creator>Behrouz Pooladrag</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Banner]]></category>
		<category><![CDATA[basic php include]]></category>
		<category><![CDATA[blog.flashbanneronline.com]]></category>
		<category><![CDATA[FlashBannerOnline.com]]></category>
		<category><![CDATA[include]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.flashbanneronline.com/?p=114</guid>
		<description><![CDATA[This tutorial will teach you the very basics on how to use a PHP #include command. The #include command is used to insert the content of an external HTML page into an existing PHP page. For example, the header and footer of this page you are reading right now are actually external files which are [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial will teach you the very basics on how to use a PHP #include command. The #include command is used to insert the content of an external HTML page into an existing PHP page. For example, the header and footer of this page you are reading right now are actually external files which are loaded into the page when you request the server to display the page. Using this technique makes it easier to update the header of all the pages of our website by simple updating a single included header file without having to update any code in any of our pages.</p>
<p align="center"><img class="alignnone size-full wp-image-115" title="include_diagram" src="http://blog.flashbanneronline.com/wp-content/uploads/2009/10/include_diagram.jpg" alt="include_diagram" width="306" height="219" /></p>
<p>This technique can be used anyone without having any advanced PHP knowledge. This tutorial will teach you how to use this command.</p>
<p>Our tutorial is divided into two main sections:</p>
<ul>
<li>Server Requirements</li>
<li> Code Implementation</li>
</ul>
<h2>Server Requirements</h2>
<p>In order to run this command you will need to have PHP installed on your server. You can check this with your hosting service provider. Any modern version of PHP will be sufficient to execute this command. Other than that, there are no specific server requirements.</p>
<h2>Code Implimentation</h2>
<p>We are going to create a very simple example in which a HOME page includes a HEADER into it. This means that we are going to need two pages the HOME page and teh HEADER page.</p>
<p>We will start off with the header page. Using any web editing tool, simply create an HTML page with the following content:</p>
<div>&lt;h1&gt;Test- The Creative Adventure!&lt;/h1&gt;</div>
<p>Note that you do not need to create a proper HTML file with &lt;html&gt;, &lt;header&gt;, or &lt;body&gt; tags, simply because our header page will not be displayed by the browser by itself and instead it <strong>will be included as part</strong> of our HOME page.</p>
<p>Save this file as <em>header.html</em>.</p>
<p>It is now time to create our HOME page. Using any web editing tool, create an HTML page with the following code:</p>
<div>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;My Test Homepage/title&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;</p>
<p>&lt;/body&gt;</p>
<p>&lt;/html&gt;</p></div>
<p>Our page does not have anything in it yet other than the page title tag. We are now going to add our #include command in the body of the page:</p>
<div>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;My Test Homepage/title&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;<br />
<strong>&lt;?php include(&#8220;header.php&#8221;); ?&gt;</strong><br />
&lt;/body&gt;</p>
<p>&lt;/html&gt;</p></div>
<p>That should insert our header at the start of our body when our page is displayed on the server. If you want to have other content in your page you can simply insert it below that tag.</p>
<div>&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;My  Test Homepage/title&gt;<br />
&lt;/head&gt;</p>
<p>&lt;body&gt;<br />
&lt;?php include(&#8220;header.php&#8221;); ?&gt;<br />
<strong>&lt;h2&gt;Welcome!&lt;/h2&gt;<br />
&lt;p&gt;Thanks for visiting my website, I hope that you have a great time here!&lt;/p&gt;</strong><br />
&lt;/body&gt;</p>
<p>&lt;/html&gt;</p></div>
<p>That should do it. You now have to save this file as <em>home.php</em>. You file <strong>MUST END WITH THE .PHP EXTENSION FOR THE SERVER TO PROCESS THE COMMAND. DO NOT FORGET THIS.</strong></p>
<p>That should do it, you will not be able to test this command on your computer unless if you have a PHP server installed. The easiest way to try this is to upload it to your server. Simply upload both files to the same directory and then access <em>home.php</em> to see the content of your <em>header.html</em> file displayed in there along with your home page content!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.flashbanneronline.com/2009/10/basic-using-the-php-include-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert MYSQL to JSON by PHP</title>
		<link>http://blog.flashbanneronline.com/2009/10/convert-mysql-to-json-by-php/</link>
		<comments>http://blog.flashbanneronline.com/2009/10/convert-mysql-to-json-by-php/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 05:08:54 +0000</pubDate>
		<dc:creator>Behrouz Pooladrag</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA["polygon to json" google api map]]></category>
		<category><![CDATA[awk convert mysql to json]]></category>
		<category><![CDATA[conver mysql to json]]></category>
		<category><![CDATA[convert a mysql dump to json]]></category>
		<category><![CDATA[convert from mysql to json]]></category>
		<category><![CDATA[convert json data to mysql sed]]></category>
		<category><![CDATA[convert json sql]]></category>
		<category><![CDATA[convert json to mysql]]></category>
		<category><![CDATA[convert json to mysql using python]]></category>
		<category><![CDATA[convert json to select mysql]]></category>
		<category><![CDATA[convert json to sql]]></category>
		<category><![CDATA[convert json value by query on mysql]]></category>
		<category><![CDATA[convert mysql array to json]]></category>
		<category><![CDATA[convert mysql into json data]]></category>
		<category><![CDATA[convert mysql polygon to json]]></category>
		<category><![CDATA[convert mysql query to json]]></category>
		<category><![CDATA[convert mysql query to json using .net example]]></category>
		<category><![CDATA[convert mysql rowset to json]]></category>
		<category><![CDATA[convert mysql t0o json]]></category>
		<category><![CDATA[convert mysql table json]]></category>
		<category><![CDATA[convert mysql to jason]]></category>
		<category><![CDATA[convert mysql to json]]></category>
		<category><![CDATA[convert mysql to json boolean]]></category>
		<category><![CDATA[convert mysql to json php rest]]></category>
		<category><![CDATA[convert mysql to json php using reset]]></category>
		<category><![CDATA[convert php json]]></category>
		<category><![CDATA[convert php mysql response to json]]></category>
		<category><![CDATA[convert plist to json mysql]]></category>
		<category><![CDATA[convert result query mysql by java to json format]]></category>
		<category><![CDATA[converting mysql array to json]]></category>
		<category><![CDATA[converting mysql full db in json format]]></category>
		<category><![CDATA[converting mysql to json]]></category>
		<category><![CDATA[converting mysql to json, display]]></category>
		<category><![CDATA[convertir mysql json]]></category>
		<category><![CDATA[dump mysql in json]]></category>
		<category><![CDATA[dump mysql to json]]></category>
		<category><![CDATA[encode mysql query into json]]></category>
		<category><![CDATA[encode mysql query using json in codeigniter]]></category>
		<category><![CDATA[encode_json mysql]]></category>
		<category><![CDATA[export data from mysql to json]]></category>
		<category><![CDATA[export mysql as json]]></category>
		<category><![CDATA[export mysql db as json]]></category>
		<category><![CDATA[export mysql php json]]></category>
		<category><![CDATA[export mysql query json]]></category>
		<category><![CDATA[export mysql query results json]]></category>
		<category><![CDATA[export mysql to json]]></category>
		<category><![CDATA[export mysql to json windows]]></category>
		<category><![CDATA[feed mysql data to json]]></category>
		<category><![CDATA[flex json php mysql]]></category>
		<category><![CDATA[gráficos javascript mysql#sclient=psy]]></category>
		<category><![CDATA[how to convert array from mysql to json]]></category>
		<category><![CDATA[how to convert mysql data to json]]></category>
		<category><![CDATA[how to convert mysql table to json with php pdf]]></category>
		<category><![CDATA[how use json_decode in mysql query runtime]]></category>
		<category><![CDATA[import json mysql]]></category>
		<category><![CDATA[import json to mysql]]></category>
		<category><![CDATA[import mysql to json]]></category>
		<category><![CDATA[java convert query mysql to json]]></category>
		<category><![CDATA[jquery json parse mysql query]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[json and mysql]]></category>
		<category><![CDATA[json decode in a mysql query]]></category>
		<category><![CDATA[json encode decode mysql]]></category>
		<category><![CDATA[json encode mysql result flash]]></category>
		<category><![CDATA[json from mysql json_decode]]></category>
		<category><![CDATA[json mysql]]></category>
		<category><![CDATA[json mysql parse procedure]]></category>
		<category><![CDATA[json mysql procedure formatting]]></category>
		<category><![CDATA[json mysql tutorial]]></category>
		<category><![CDATA[json object from mysql stored procedure jsp]]></category>
		<category><![CDATA[json php mysql]]></category>
		<category><![CDATA[json serialize,myquery,mysql]]></category>
		<category><![CDATA[json to sql convert]]></category>
		<category><![CDATA[json view mysql]]></category>
		<category><![CDATA[json_decode after mysql]]></category>
		<category><![CDATA[json_decode to mysql]]></category>
		<category><![CDATA[json_decode with mysql]]></category>
		<category><![CDATA[json_encode examples mysql]]></category>
		<category><![CDATA[json_encode mysql]]></category>
		<category><![CDATA[json_encode mysql typ]]></category>
		<category><![CDATA[json_encode online]]></category>
		<category><![CDATA[json_encode text mysql]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[mysql convert json]]></category>
		<category><![CDATA[mysql convert sql to json]]></category>
		<category><![CDATA[mysql convert to json]]></category>
		<category><![CDATA[mysql dans json_encode]]></category>
		<category><![CDATA[mysql dump as json]]></category>
		<category><![CDATA[mysql dump json]]></category>
		<category><![CDATA[mysql et json_encode]]></category>
		<category><![CDATA[mysql export json]]></category>
		<category><![CDATA[mysql export to json]]></category>
		<category><![CDATA[mysql fetch array json]]></category>
		<category><![CDATA[mysql fetcharray convert to json]]></category>
		<category><![CDATA[mysql format as json]]></category>
		<category><![CDATA[mysql function convert to json]]></category>
		<category><![CDATA[mysql function json convert]]></category>
		<category><![CDATA[mysql import json]]></category>
		<category><![CDATA[mysql import json jdbc]]></category>
		<category><![CDATA[mysql insert to json converter]]></category>
		<category><![CDATA[mysql json converter]]></category>
		<category><![CDATA[mysql json decode]]></category>
		<category><![CDATA[mysql json encode]]></category>
		<category><![CDATA[mysql json parse]]></category>
		<category><![CDATA[mysql json tutorial]]></category>
		<category><![CDATA[mysql json_decode equivalent]]></category>
		<category><![CDATA[mysql json_encode dreamweaver]]></category>
		<category><![CDATA[mysql json_parse]]></category>
		<category><![CDATA[mysql parse json]]></category>
		<category><![CDATA[mysql parse json django]]></category>
		<category><![CDATA[mysql parse json_decode]]></category>
		<category><![CDATA[mysql query decrypt json object]]></category>
		<category><![CDATA[mysql query json_encode dojo datagrid]]></category>
		<category><![CDATA[mysql query json_encode($myarray);]]></category>
		<category><![CDATA[mysql query with json_decode]]></category>
		<category><![CDATA[mysql recursive json]]></category>
		<category><![CDATA[mysql recursive json_encode]]></category>
		<category><![CDATA[mysql stored procedure convert json]]></category>
		<category><![CDATA[mysql text, convert to json]]></category>
		<category><![CDATA[mysql to json]]></category>
		<category><![CDATA[mysql to json convert]]></category>
		<category><![CDATA[mysql to json converter]]></category>
		<category><![CDATA[mysql to json export]]></category>
		<category><![CDATA[mysql to json format]]></category>
		<category><![CDATA[mysql to json php]]></category>
		<category><![CDATA[mysql 转json]]></category>
		<category><![CDATA[mysql_query json encode]]></category>
		<category><![CDATA[php "json to mysql"]]></category>
		<category><![CDATA[php encode_json mysql result]]></category>
		<category><![CDATA[php flash json]]></category>
		<category><![CDATA[php json tutorial mysql]]></category>
		<category><![CDATA[php mysql json]]></category>
		<category><![CDATA[php mysql json example]]></category>
		<category><![CDATA[php mysql json export]]></category>
		<category><![CDATA[php mysql json_encode column rename]]></category>
		<category><![CDATA[polygontojson]]></category>
		<category><![CDATA[rails convert mysql result to json]]></category>
		<category><![CDATA[send json to mysql stored procedures]]></category>
		<category><![CDATA[serialize mysql json]]></category>
		<category><![CDATA[storedprocedure for json]]></category>
		<category><![CDATA[tot]]></category>
		<category><![CDATA[transform mysql call to json]]></category>
		<category><![CDATA[transform mysql table json]]></category>
		<category><![CDATA[เปลี่ยน json to mysql]]></category>

		<guid isPermaLink="false">http://blog.flashbanneronline.com/?p=53</guid>
		<description><![CDATA[I did not find any function to convert the result of a MySQL query directly into JSON notation, so I made my own function. The first parameter is the result of the query, without any parsing, just the output of mysql_query function, the second parameter is the name you want to give to your JSON [...]]]></description>
			<content:encoded><![CDATA[<p>I did not find any function to convert the result of a MySQL query directly into JSON notation, so I made my own function.</p>
<p></p>
<pre class="brush: php; title: ; notranslate">function mysql2json($mysql_result,$name){
$json=&quot;{\n\&quot;$name\&quot;: [\n&quot;;
$field_names = array();
$fields = mysql_num_fields($mysql_result);
for($x=0;$x&amp;lt; $fields;$x++){
$field_name = mysql_fetch_field($mysql_result, $x);
if($field_name){
$field_names[$x]=$field_name-&amp;gt;name;
}
}
$rows = mysql_num_rows($mysql_result);
for($x=0;$x&amp;lt; $rows;$x++){
$row = mysql_fetch_array($mysql_result);
$json.=&quot;{\n&quot;;
for($y=0;$y&amp;lt;count($field_names);$y++) {
$json.=&quot;\&quot;$field_names[$y]\&quot; :    \&quot;$row[$y]\&quot;&quot;;
if($y==count($field_names)-1){
$json.=&quot;\n&quot;;
}
else{
$json.=&quot;,\n&quot;;
}
}
if($x==$rows-1){
$json.=&quot;\n}\n&quot;;
}
else{
$json.=&quot;\n},\n&quot;;
}
}
$json.=&quot;]\n};&quot;;
return($json);
}</pre>
<p>The first parameter is the result of the query, without any parsing, just the output of <strong><code>mysql_query</code> </strong>function, the second parameter is the name you want to give to your JSON object.</p>
<p>Returns a string with the JSON notation of the result.</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">I did not find any function to convert the result of a MySQL query directly into JSON notation, so I made my own function.</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.flashbanneronline.com/2009/10/convert-mysql-to-json-by-php/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Connection speed with php</title>
		<link>http://blog.flashbanneronline.com/2009/10/connection-speed-with-php/</link>
		<comments>http://blog.flashbanneronline.com/2009/10/connection-speed-with-php/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 04:10:49 +0000</pubDate>
		<dc:creator>Behrouz Pooladrag</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[connection]]></category>
		<category><![CDATA[speed]]></category>

		<guid isPermaLink="false">http://blog.flashbanneronline.com/?p=60</guid>
		<description><![CDATA[One of the hardest script you can find in internet is the one that determines connection speed of a surfer visiting our site. From today it&#8217;s not anymore a problem (even if nobody had nightmares before&#8230;) because we will make a php script in order to fill such lack. Let&#8217;s start coding&#8230; &#60;?php $kb=512; echo [...]]]></description>
			<content:encoded><![CDATA[<p>One of the hardest script you can find in internet is the one that determines connection speed of a surfer visiting our site.<br />
From today it&#8217;s not anymore a problem (even if nobody had nightmares before&#8230;) because we will make a php script in order to fill such lack.</p>
<p>Let&#8217;s start coding&#8230;</p>
<p><code><br />
&lt;?php<br />
$kb=512;<br />
echo "streaming $kb Kb...&lt;!-";<br />
flush();<br />
$time = explode(" ",microtime());<br />
$start = $time[0] + $time[1];<br />
for($x=0;$x&lt;$kb;$x++){<br />
echo str_pad('', 1024, '.');<br />
flush();<br />
}<br />
$time = explode(" ",microtime());<br />
$finish = $time[0] + $time[1];<br />
$deltat = $finish - $start;<br />
echo "-&gt; Test finished in $deltat seconds. Your speed is ". round($kb / $deltat, 3)."Kb/s";<br />
?&gt;<br />
</code></p>
<p>Done. Analysis and considerations:</p>
<p>2: Declaring how much Kb I want to transmit to accomplish the test. This value can also be passed in POST or GET. In my example it is declared.</p>
<p>3: I write I am downloading data, and open a comment tag. Everithing I am sending from now on will not be displayed. It&#8217;s not necessary, but prevents the browser to be fullfilled of chars.</p>
<p>4: Flush the chache</p>
<p>5-6: Saving actual timestamp</p>
<p>7-9: For $kb times I send 1024 chars (1Kb) and flush the cache</p>
<p>11-12: Saving actual timestamp</p>
<p>13: Calculating difference between start and finish timestamps</p>
<p>14: Closing comment tag and writing test result, calculated as Kb/time</p>
<p>Done&#8230; very easy isn&#8217;t it?</p>
<p><strong>Considerations and exceptions</strong></p>
<p>I wasn&#8217;t able to get reliable speed values with $kb under 512. I noticed the higher this number, the more reliable the result.</p>
<p>In some php configurations, those with output buffering to &#8220;On&#8221;, php executes before sending headers, cookies, and so on, and the time calculated in that way is the time of pure execution (excluding tranfers). Disabling output buffering, however, results are reliable.</p>
<p>You can try the script at <a href="http://www.triquitips.com/timetest.php" target="_blank">this page</a>.</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">&lt;style&gt;<br />
pre {direction:ltr;}<br />
&lt;/style&gt;<br />
&lt;code&gt;<br />
&amp;lt;?php<br />
$kb=512;<br />
echo &amp;quot;streaming $kb Kb&#8230;&amp;lt;!-&amp;quot;;<br />
flush();<br />
$time = explode(&amp;quot; &amp;quot;,microtime());<br />
$start = $time[0] + $time[1];<br />
for($x=0;$x&amp;lt;$kb;$x++){<br />
echo str_pad(&#8221;, 1024, &#8216;.&#8217;);<br />
flush();<br />
}<br />
$time = explode(&amp;quot; &amp;quot;,microtime());<br />
$finish = $time[0] + $time[1];<br />
$deltat = $finish &#8211; $start;<br />
echo &amp;quot;-&amp;gt; Test finished in $deltat seconds. Your speed is &amp;quot;. round($kb / $deltat, 3).&amp;quot;Kb/s&amp;quot;;<br />
?&amp;gt;<br />
&lt;/code&gt;</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.flashbanneronline.com/2009/10/connection-speed-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced
Database Caching 31/66 queries in 1.017 seconds using disk: basic
Object Caching 2261/2477 objects using disk: basic

Served from: blog.flashbanneronline.com @ 2012-02-11 13:08:13 -->
