<?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>Fahdi&#039;s Personal Blog &#187; PHP Tips</title>
	<atom:link href="http://www.fahdmurtaza.com/myblog/category/php-tips/feed" rel="self" type="application/rss+xml" />
	<link>http://www.fahdmurtaza.com/myblog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 30 Aug 2010 09:35:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>PHP tip: Best way to get file extension</title>
		<link>http://www.fahdmurtaza.com/myblog/2010/07/25/best-way-to-get-file-extension.html</link>
		<comments>http://www.fahdmurtaza.com/myblog/2010/07/25/best-way-to-get-file-extension.html#comments</comments>
		<pubDate>Sun, 25 Jul 2010 09:21:14 +0000</pubDate>
		<dc:creator>Fahd</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Tips]]></category>
		<category><![CDATA[code file extension php]]></category>

		<guid isPermaLink="false">http://www.fahdmurtaza.com/myblog/?p=714</guid>
		<description><![CDATA[I tried 100 ways to get the file extension from a complete file path including directories and file name with extension. This one works perfectly. This uses php function pathinfo to get the directory name, filename and its extension for you which is very handy. &#60;?php $fileinfo = pathinfo(“/path/to/your/file.php”); echo $fileinfo['dirname']; // Get directory echo $fileinfo['basename']; // Get file [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.fahdmurtaza.com%2Fmyblog%2F2010%2F07%2F25%2Fbest-way-to-get-file-extension.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.fahdmurtaza.com%2Fmyblog%2F2010%2F07%2F25%2Fbest-way-to-get-file-extension.html&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I tried 100 ways to get the file extension from a complete file path including directories and file name with extension. This one works perfectly. This uses php function <a title="PHP pathinfo " href="http://php.net/manual/en/function.pathinfo.php" target="_blank">pathinfo </a>to get the directory name, filename and its extension for you which is very handy.</p>
<div id="_mcePaste">&lt;?php</div>
<p><span id="more-714"></span></p>
<div></div>
<div id="_mcePaste">$fileinfo = pathinfo(“/path/to/your/file.php”);</div>
<div id="_mcePaste">echo $fileinfo['dirname']; // Get directory</div>
<div id="_mcePaste">echo $fileinfo['basename']; // Get file basename</div>
<div id="_mcePaste">echo $fileinfo['extension']; // Get file extension</div>
<div id="_mcePaste">echo $fileinfo['filename']; // Get file name</div>
<div id="_mcePaste">?&gt;</div>
<blockquote><p><code> </code></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.fahdmurtaza.com/myblog/2010/07/25/best-way-to-get-file-extension.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Testing zend optimizer encoded PHP applications</title>
		<link>http://www.fahdmurtaza.com/myblog/2010/07/04/testing-zend-optimizer-encoded-php-applications.html</link>
		<comments>http://www.fahdmurtaza.com/myblog/2010/07/04/testing-zend-optimizer-encoded-php-applications.html#comments</comments>
		<pubDate>Sun, 04 Jul 2010 13:17:13 +0000</pubDate>
		<dc:creator>Fahd</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Tips]]></category>
		<category><![CDATA[expressionengine testing php application 'zend optimizer' encoded]]></category>

		<guid isPermaLink="false">http://www.fahdmurtaza.com/myblog/?p=664</guid>
		<description><![CDATA[I am working on an expressionengine application these days. As I am using the beta version of expression engine until they release the final version, so the source files are encoded with the zend optimizer. Zend optimizer has a limitation that it can&#8217;t work with version 5.3 of PHP so far. I had the latest [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.fahdmurtaza.com%2Fmyblog%2F2010%2F07%2F04%2Ftesting-zend-optimizer-encoded-php-applications.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.fahdmurtaza.com%2Fmyblog%2F2010%2F07%2F04%2Ftesting-zend-optimizer-encoded-php-applications.html&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I am working on an expressionengine application these days. As I am using the beta version of expression engine until they release the final version, so the source files are encoded with the zend optimizer. Zend optimizer has a limitation that it can&#8217;t work with version 5.3 of PHP so far.<a href="http://www.fahdmurtaza.com/myblog/wp-content/uploads/2010/07/expressionengine_logo.png"><img src="http://www.fahdmurtaza.com/myblog/wp-content/uploads/2010/07/expressionengine_logo-150x150.png" alt="" title="expressionengine_logo" width="150" height="150" class="alignright size-thumbnail wp-image-705" /></a></p>
<p>I had the latest XAMPP installed on my Windows VISTA machine for a year now but I found out that Zend optimiser isn&#8217;t compatible with version of PHP it provided i.e PHP 5.3, so I downloaded the version 1.6.8 of XAMPP from http://sourceforge.net/projects/xampp/files/ which has the older version of PHP i.e 5.2 which is compatible with Zend Optimizer.<span id="more-664"></span></p>
<p>Now here is the thing, I downloaded the Zend Optimizer from <a href="http://www.zend.com/en/products/guard/zend-optimizer" target="_blank">this link</a> and installed it.  In its installation steps it asks you for two locations which you have to tell it correctly or else it will not work properly.</p>
<ol>
<li>The path to php.ini</li>
<li>The path to Apache websrver&#8217;s root.</li>
</ol>
<p>Based on the installation directory of your XAMPP, you can select appropriate directories in these steps. I chose default <em><strong>C:\xampp </strong><span style="font-style: normal;">while installing XAMPP,  so I selected <strong><em>C:\xampp\apache\bin </em><span style="font-weight: normal;">and C:\xampp\apache for the Steps 1 and 2 respectively. </span></strong></span></em></p>
<p>And before that, using XAMPP control panel, I had stopped the Apache so when the configuration changes take place, the next time apache runs, it loads this new php.ini file which is changed by the zend optimizer installation.</p>
<p>Next thing you want to do is, check the php info using <strong><em>phpinfo.php</em></strong> file using the follwing url.</p>
<p><a href="http://localhost/xampp/phpinfo.php">http://localhost/xampp/phpinfo.php</a></p>
<p>It will open up a page with a bunch of information. Look for the text  <strong><em>Loaded Configuration File <span style="font-style: normal;"><span style="font-weight: normal;">and open the same php file using windows explorer.</span></span></em></strong></p>
<p><strong><em><span style="font-style: normal;"><span style="font-weight: normal;">For me it was</span></span></em></strong></p>
<table border="0" cellpadding="3" width="600">
<tbody>
<tr>
<td>Loaded Configuration File</td>
<td>C:\xampp\apache\bin\php.ini</td>
</tr>
</tbody>
</table>
<p>So I opened the php.ini folder and searched for the line where Zend Optimiser properties were mentioned and</p>
<p><code></p>
<div id="_mcePaste">[Zend]</div>
<div id="_mcePaste">zend_extension_ts="C:\Program Files\Zend\ZendOptimizer-3.3.0\lib\ZendExtensionManager.dll"</div>
<div id="_mcePaste">zend_extension_manager.optimizer_ts="C:\Program Files\Zend\ZendOptimizer-3.3.0\lib\Optimizer-3.3.0"</div>
<div id="_mcePaste"><strong>zend_optimizer.enable_loader = 0</strong></div>
<div id="_mcePaste">zend_optimizer.optimization_level=15</div>
<div id="_mcePaste">;zend_optimizer.license_path =</div>
<div id="_mcePaste">; Local Variables:</div>
<div id="_mcePaste">; tab-width: 4</div>
<div id="_mcePaste">; End:</div>
<p>[Zend]zend_extension_ts="C:\Program Files\Zend\ZendOptimizer-3.3.0\lib\ZendExtensionManager.dll"zend_extension_manager.optimizer_ts="C:\Program Files\Zend\ZendOptimizer-3.3.0\lib\Optimizer-3.3.0"zend_optimizer.enable_loader = 1zend_optimizer.optimization_level=15;zend_optimizer.license_path =; Local Variables:; tab-width: 4; End:</p>
<p></code></p>
<p>In the above code I changed</p>
<p><code><br />
zend_optimizer.enable_loader = 0<br />
</code></p>
<p>to</p>
<p><code><br />
zend_optimizer.enable_loader = 1<br />
</code></p>
<p>So its loaded the next time I start the apache.<br />
<a href="http://www.fahdmurtaza.com/myblog/wp-content/uploads/2010/07/php_doodle.png"><img src="http://www.fahdmurtaza.com/myblog/wp-content/uploads/2010/07/php_doodle-150x150.png" alt="" title="php_doodle" width="150" height="150" class="alignright size-thumbnail wp-image-710" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fahdmurtaza.com/myblog/2010/07/04/testing-zend-optimizer-encoded-php-applications.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Text cropping with defining the number of characters, words or sentences</title>
		<link>http://www.fahdmurtaza.com/myblog/2009/03/18/585.html</link>
		<comments>http://www.fahdmurtaza.com/myblog/2009/03/18/585.html#comments</comments>
		<pubDate>Wed, 18 Mar 2009 09:53:50 +0000</pubDate>
		<dc:creator>ahmed</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[characters]]></category>
		<category><![CDATA[crop]]></category>
		<category><![CDATA[crop by number of]]></category>
		<category><![CDATA[crop text]]></category>
		<category><![CDATA[sentences]]></category>
		<category><![CDATA[string manipulation]]></category>
		<category><![CDATA[strings]]></category>
		<category><![CDATA[words]]></category>

		<guid isPermaLink="false">http://www.fahdmurtaza.com/myblog/?p=585</guid>
		<description><![CDATA[I was asked to develop the functionality in a such a way that text can be cropped in these three ways.

   1. With defining the number of words.
   2. With defining the numbers of characters.
   3. With defining the number of sentences.

Here is a set of functions that helps you crop a text in three different ways. The usage of the function is also mentioned at the end f the script.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.fahdmurtaza.com%2Fmyblog%2F2009%2F03%2F18%2F585.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.fahdmurtaza.com%2Fmyblog%2F2009%2F03%2F18%2F585.html&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I have recently been working on PHP RSS reader script that was supposed to do three different things with RSS description text. To make a teaser RSS text, I was asked to develop the functionality in a such a way that text can be cropped in these three ways.</p>
<ul>
<li><strong>with defining the number of words.</strong></li>
<li><strong>with defining the numbers of characters.</strong></li>
<li><strong>with defining the number of sentences.</strong></li>
</ul>
<p>Here is a set of  functions that helps you crop a text in three different ways. The usage of the function is also mentioned at the end f the script.<span id="more-585"></span><br />
<code><span style="color: #000000;"> <span style="color: #0000bb;">&lt;?php</span></span></code></p>
<p><span style="color: #ff8000;">/**<br />
* cropsentence()<br />
*<br />
* @param mixed $str<br />
* @param mixed $noof<br />
* @param integer $mode<br />
// 0 means crop by no of characters // 1 means crop by no of sentences // 2 means crop by number of words<br />
* @param string $appendwith<br />
* @return<br />
*/<br />
</span><span style="color: #007700;">function </span><span style="color: #0000bb;">cropsentence</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$str</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$noof</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$mode </span><span style="color: #007700;">= </span><span style="color: #0000bb;">0</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$appendwith </span><span style="color: #007700;">= </span><span style="color: #dd0000;">&#8220;&#8230;&#8221;</span><span style="color: #007700;">)<br />
{<br />
if (</span><span style="color: #0000bb;">strlen</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$str</span><span style="color: #007700;">) &gt; </span><span style="color: #0000bb;">$chars</span><span style="color: #007700;">) {<br />
if (</span><span style="color: #0000bb;">$mode </span><span style="color: #007700;">== </span><span style="color: #0000bb;">0</span><span style="color: #007700;">) { </span><span style="color: #ff8000;">// 0 means crop by no of characters<br />
</span><span style="color: #0000bb;">$str </span><span style="color: #007700;">= </span><span style="color: #0000bb;">substr</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$str</span><span style="color: #007700;">, </span><span style="color: #0000bb;">0</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$noof</span><span style="color: #007700;">);<br />
} elseif (</span><span style="color: #0000bb;">$mode </span><span style="color: #007700;">== </span><span style="color: #0000bb;">1</span><span style="color: #007700;">) { </span><span style="color: #ff8000;">// 1 means crop by no of sentences<br />
</span><span style="color: #0000bb;">$str </span><span style="color: #007700;">= </span><span style="color: #0000bb;">getLeadingSentences</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$str</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$noof</span><span style="color: #007700;">);<br />
} elseif (</span><span style="color: #0000bb;">$mode </span><span style="color: #007700;">== </span><span style="color: #0000bb;">2</span><span style="color: #007700;">) { </span><span style="color: #ff8000;">// 2 means crop by number of words<br />
</span><span style="color: #0000bb;">$str </span><span style="color: #007700;">= </span><span style="color: #0000bb;">wordTrim</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$str</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$noof</span><span style="color: #007700;">);</span></p>
<p>} elseif (<span style="color: #0000bb;">$mode </span><span style="color: #007700;">&lt; </span><span style="color: #0000bb;">0 </span><span style="color: #007700;">|| </span><span style="color: #0000bb;">$mode </span><span style="color: #007700;">&gt; </span><span style="color: #0000bb;">2</span><span style="color: #007700;">) { </span><span style="color: #ff8000;">// others means do nothing<br />
</span><span style="color: #007700;">echo </span><span style="color: #dd0000;">&#8220;The current mode is not correct.&#8221;</span><span style="color: #007700;">;<br />
}<br />
</span><span style="color: #0000bb;">$str </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$str </span><span style="color: #007700;">. </span><span style="color: #0000bb;">$appendwith</span><span style="color: #007700;">;<br />
return </span><span style="color: #0000bb;">$str</span><span style="color: #007700;">;<br />
} else {<br />
return </span><span style="color: #0000bb;">$str</span><span style="color: #007700;">;<br />
}<br />
}</span></p>
<p><span style="color: #ff8000;">//getLeadingSentences<br />
//Copyright (c) 2000 Jason R. Pitoniak.  All rights reserved.<br />
//jason@interbrite.com http://www.interbrite.com</span></p>
<p>//If you find this code useful, find a bug, or have a suggestion,<br />
//please email me.  Feel free to use this code for any purpose.</p>
<p>/**<br />
* getLeadingSentences()<br />
*<br />
* @param mixed $data<br />
* @param mixed $max<br />
* @return<br />
*/<br />
<span style="color: #007700;">function </span><span style="color: #0000bb;">getLeadingSentences</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$data</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$max</span><span style="color: #007700;">)<br />
{<br />
</span><span style="color: #ff8000;">//given string $data, will return the first $max sentences in that string</span></p>
<p>//in: $data = the string to parse, $max = maximum # of sentences to return<br />
//returns: string containing the first $max sentences<br />
//(If the # of sentences in the string is less than $max,<br />
//then entire string will be returned.)</p>
<p>//a sentence is any charactors except ., !, and ?<br />
//any number of times,  plus one or more .s, ?s, or !s<br />
//and any leading or trailing whitespace:<br />
<span style="color: #0000bb;">$re </span><span style="color: #007700;">= </span><span style="color: #dd0000;">&#8220;^s*[^.?!]+[.?!]+s*&#8221;</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$out </span><span style="color: #007700;">= </span><span style="color: #dd0000;">&#8220;&#8221;</span><span style="color: #007700;">;<br />
for (</span><span style="color: #0000bb;">$i </span><span style="color: #007700;">= </span><span style="color: #0000bb;">0</span><span style="color: #007700;">; </span><span style="color: #0000bb;">$i </span><span style="color: #007700;">&lt; </span><span style="color: #0000bb;">$max</span><span style="color: #007700;">; </span><span style="color: #0000bb;">$i</span><span style="color: #007700;">++) {<br />
if (</span><span style="color: #0000bb;">ereg</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$re</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$data</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$match</span><span style="color: #007700;">)) {<br />
</span><span style="color: #ff8000;">//if a sentence is found, take it out of $data and add it to $out<br />
</span><span style="color: #0000bb;">$out </span><span style="color: #007700;">.= </span><span style="color: #0000bb;">$match</span><span style="color: #007700;">[</span><span style="color: #0000bb;">0</span><span style="color: #007700;">];<br />
</span><span style="color: #0000bb;">$data </span><span style="color: #007700;">= </span><span style="color: #0000bb;">ereg_replace</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$re</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8220;&#8221;</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$data</span><span style="color: #007700;">);<br />
} else {<br />
</span><span style="color: #0000bb;">$i </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$max</span><span style="color: #007700;">;<br />
}<br />
}<br />
return </span><span style="color: #0000bb;">$out</span><span style="color: #007700;">;<br />
}</span></p>
<p><span style="color: #ff8000;">/**<br />
* getLeadingWords()<br />
*<br />
* @param mixed $data<br />
* @param mixed $max<br />
* @return<br />
*/<br />
</span><span style="color: #007700;">function </span><span style="color: #0000bb;">getLeadingWords</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$data</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$max</span><span style="color: #007700;">)<br />
{<br />
</span><span style="color: #ff8000;">//given string $data, will return the first $max sentences in that string</span></p>
<p>//in: $data = the string to parse, $max = maximum # of sentences to return<br />
//returns: string containing the first $max sentences<br />
//(If the # of sentences in the string is less than $max,<br />
//then entire string will be returned.)</p>
<p>//a sentence is any charactors except ., !, and ?<br />
//any number of times,  plus one or more .s, ?s, or !s<br />
//and any leading or trailing whitespace:<br />
<span style="color: #0000bb;">$re </span><span style="color: #007700;">= </span><span style="color: #dd0000;">&#8220;^s*[^.?!]+[.?!]+s*&#8221;</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$out </span><span style="color: #007700;">= </span><span style="color: #dd0000;">&#8220;&#8221;</span><span style="color: #007700;">;<br />
for (</span><span style="color: #0000bb;">$i </span><span style="color: #007700;">= </span><span style="color: #0000bb;">0</span><span style="color: #007700;">; </span><span style="color: #0000bb;">$i </span><span style="color: #007700;">&lt; </span><span style="color: #0000bb;">$max</span><span style="color: #007700;">; </span><span style="color: #0000bb;">$i</span><span style="color: #007700;">++) {<br />
if (</span><span style="color: #0000bb;">ereg</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$re</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$data</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$match</span><span style="color: #007700;">)) {<br />
</span><span style="color: #ff8000;">//if a sentence is found, take it out of $data and add it to $out<br />
</span><span style="color: #0000bb;">$out </span><span style="color: #007700;">.= </span><span style="color: #0000bb;">$match</span><span style="color: #007700;">[</span><span style="color: #0000bb;">0</span><span style="color: #007700;">];<br />
</span><span style="color: #0000bb;">$data </span><span style="color: #007700;">= </span><span style="color: #0000bb;">ereg_replace</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$re</span><span style="color: #007700;">, </span><span style="color: #dd0000;">&#8220;&#8221;</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$data</span><span style="color: #007700;">);<br />
} else {<br />
</span><span style="color: #0000bb;">$i </span><span style="color: #007700;">= </span><span style="color: #0000bb;">$max</span><span style="color: #007700;">;<br />
}<br />
}<br />
return </span><span style="color: #0000bb;">$out</span><span style="color: #007700;">;<br />
}</span></p>
<p><span style="color: #ff8000;">/**<br />
* wordTrim()<br />
*<br />
* @param mixed $str<br />
* @param mixed $len<br />
* @return<br />
*/<br />
</span><span style="color: #007700;">function </span><span style="color: #0000bb;">wordTrim</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$str</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$len</span><span style="color: #007700;">)<br />
{<br />
</span><span style="color: #0000bb;">$wordCount </span><span style="color: #007700;">= </span><span style="color: #0000bb;">0</span><span style="color: #007700;">;<br />
</span><span style="color: #0000bb;">$charCount </span><span style="color: #007700;">= </span><span style="color: #0000bb;">0</span><span style="color: #007700;">;</span></p>
<p><span style="color: #0000bb;">$length </span><span style="color: #007700;">= </span><span style="color: #0000bb;">strlen</span><span style="color: #007700;">(</span><span style="color: #0000bb;">strip_tags</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$str</span><span style="color: #007700;">));<br />
for (</span><span style="color: #0000bb;">$i </span><span style="color: #007700;">= </span><span style="color: #0000bb;">0</span><span style="color: #007700;">; </span><span style="color: #0000bb;">$i </span><span style="color: #007700;">&lt; </span><span style="color: #0000bb;">$length</span><span style="color: #007700;">; </span><span style="color: #0000bb;">$i</span><span style="color: #007700;">++) {<br />
if (</span><span style="color: #0000bb;">$str</span><span style="color: #007700;">[</span><span style="color: #0000bb;">$i</span><span style="color: #007700;">] == </span><span style="color: #dd0000;">&#8216; &#8217;</span><span style="color: #007700;">) {<br />
</span><span style="color: #0000bb;">$wordCount</span><span style="color: #007700;">++;<br />
</span><span style="color: #0000bb;">$charCount</span><span style="color: #007700;">++;<br />
if (</span><span style="color: #0000bb;">$wordCount </span><span style="color: #007700;">== </span><span style="color: #0000bb;">$len</span><span style="color: #007700;">)<br />
break;<br />
} else {<br />
</span><span style="color: #0000bb;">$charCount</span><span style="color: #007700;">++;<br />
} </span><span style="color: #ff8000;"># end if<br />
</span><span style="color: #007700;">} </span><span style="color: #ff8000;"># end for loop</span></p>
<p><span style="color: #0000bb;">$newstr </span><span style="color: #007700;">= </span><span style="color: #0000bb;">substr</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$str</span><span style="color: #007700;">, </span><span style="color: #0000bb;">0</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$charCount</span><span style="color: #007700;">);<br />
return </span><span style="color: #0000bb;">$newstr</span><span style="color: #007700;">;<br />
} </span><span style="color: #ff8000;"># end function</span></p>
<p># Example used for testing purpose</p>
<p><span style="color: #0000bb;">$str2 </span><span style="color: #007700;">= </span><span style="color: #dd0000;">&#8220;Hello there I work for you. I have been working for other guys, but you are the coolest guy among them.<br />
Also I really like the way you guide me with new technologies and the latest trends. You always tell me to keep working hard!&#8221;</span><span style="color: #007700;">;<br />
echo </span><span style="color: #0000bb;">cropsentence</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$str2</span><span style="color: #007700;">, </span><span style="color: #0000bb;">22</span><span style="color: #007700;">, </span><span style="color: #0000bb;">2</span><span style="color: #007700;">);</span></p>
<p><span style="color: #0000bb;">?&gt;</span></p>
<h3>Usage</h3>
<p><span style="color: #0000bb;">cropsentence</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$str</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$noof</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$mode</span><span style="color: #007700;">, </span><span style="color: #0000bb;">$appendwith </span><span style="color: #007700;">);</span></p>
<p><strong>$str:</strong> This is the string / text to be cropped</p>
<p><strong>$noof: </strong>Number of characters/words/sentences based on the $mode parameter</p>
<p><strong>$mode: </strong>Three values of $mode can be defined</p>
<p>1. <strong>0</strong> means crop by no of characters.<br />
2. <strong>1 </strong>means crop by no of sentences .<br />
3.<strong> 2</strong> means crop by number of words.</p>
<p><strong>$appendwith: </strong>This can be any characters like &#8216;&#8230;&#8217; , &#8216;&#8230;more&#8217; etc which will be appended with the cropped text when its returned.</p>
<p><strong>Download:</strong></p>
<p>You can download the script here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fahdmurtaza.com/myblog/2009/03/18/585.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to make sure your PHP RSS feed reader doesn&#8217;t mess up</title>
		<link>http://www.fahdmurtaza.com/myblog/2009/03/18/how-to-make-sure-your-php-rss-feed-reader-doesnt-mess-up.html</link>
		<comments>http://www.fahdmurtaza.com/myblog/2009/03/18/how-to-make-sure-your-php-rss-feed-reader-doesnt-mess-up.html#comments</comments>
		<pubDate>Wed, 18 Mar 2009 07:20:00 +0000</pubDate>
		<dc:creator>ahmed</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[crop html]]></category>
		<category><![CDATA[crop text]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[reader]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[strip_tags]]></category>

		<guid isPermaLink="false">http://www.fahdmurtaza.com/myblog/?p=579</guid>
		<description><![CDATA[This post helps you with cropping long text into small with taking care of html tags that can get cropped in the mid due to unknown length of cropping.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.fahdmurtaza.com%2Fmyblog%2F2009%2F03%2F18%2Fhow-to-make-sure-your-php-rss-feed-reader-doesnt-mess-up.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.fahdmurtaza.com%2Fmyblog%2F2009%2F03%2F18%2Fhow-to-make-sure-your-php-rss-feed-reader-doesnt-mess-up.html&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>I was recently working on a custom RSS feed reader where the prior most concern of the client was being able to crop the text with respect to the</p>
<ol>
<li>Number of words.</li>
<li>Numbers of characters.</li>
<li>Number of sentences.<span id="more-579"></span></li>
</ol>
<p>So a very important measure had to be taken. Since the cropping can end up giving us a broken link if its text  is cropped before the &lt;/a&gt; tag, our output can end up as a disaster.</p>
<p>So here is a little script that can help you strip off your html tags in such situations.<br />
<code><br />
&lt;?php</code></p>
<p><code>$text = "This is a link to &lt;a href='http://www.fahdmurtaza.com/myblog/'&gt;Fahd Murtaza's &lt;/a&gt; site!";<br />
echo strip_tags($text, "<a>");</a></code></p>
<p><code><a>?&gt;</a></code></p>
<p>So <strong>strip_tags</strong> would end up removing anything from the <strong>$text</strong>. The second parameter of the <strong>strip_tags</strong> will simply declare any html tags you want to neglect while stripping the text. Off course you will need to deal with them separately in text cropping situations like I had.</p>
<p>Here is one more example.</p>
<div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000;"> <span style="color: #0000bb;">&lt;?php<br />
$text </span><span style="color: #007700;">= </span><span style="color: #dd0000;">'&lt;p&gt;Test paragraph.&lt;/p&gt;&lt;!-- Comment --&gt; &lt;a href="#fragment"&gt;Other text&lt;/a&gt;'</span><span style="color: #007700;">;<br />
echo </span><span style="color: #0000bb;">strip_tags</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$text</span><span style="color: #007700;">);<br />
echo </span><span style="color: #dd0000;">"\n"</span><span style="color: #007700;">;</p>
<p></span><span style="color: #ff8000;">// Allow &lt;p&gt; and &lt;a&gt;<br />
</span><span style="color: #007700;">echo </span><span style="color: #0000bb;">strip_tags</span><span style="color: #007700;">(</span><span style="color: #0000bb;">$text</span><span style="color: #007700;">, </span><span style="color: #dd0000;">'&lt;p&gt;&lt;a&gt;'</span><span style="color: #007700;">);<br />
</span><span style="color: #0000bb;">?&gt;</span></span></code></div>
<div class="phpcode"></div>
<div class="phpcode">For more infomation, please check this function&#8217;s reference on <a title="strip_tags PHP Function" href="http://www.php.net/strip_tags" target="_blank">PHP&#8217;s official website</a>.</div>
<div class="phpcode"></div>
<div class="phpcode">Also if you are interested in getting the PHP RSS reader script I did, I would encourage you to visit this link  of my next post. Also, if you are intersted in having the script that does the cropping by</div>
<div class="phpcode">
<ol>
<li>Number of words.</li>
<li>Numbers of characters.</li>
<li>Number of sentences.</li>
</ol>
<p>you can get it here.</p></div>
<div class="phpcode"></div>
<div class="phpcode"></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.fahdmurtaza.com/myblog/2009/03/18/how-to-make-sure-your-php-rss-feed-reader-doesnt-mess-up.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: How to rewmove last comma from a string</title>
		<link>http://www.fahdmurtaza.com/myblog/2008/11/25/php-how-to-rewmove-last-comma-from-a-string.html</link>
		<comments>http://www.fahdmurtaza.com/myblog/2008/11/25/php-how-to-rewmove-last-comma-from-a-string.html#comments</comments>
		<pubDate>Tue, 25 Nov 2008 10:58:34 +0000</pubDate>
		<dc:creator>ahmed</dc:creator>
				<category><![CDATA[PHP Tips]]></category>
		<category><![CDATA[comma]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[removal]]></category>
		<category><![CDATA[removing]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://www.fahdmurtaza.com/myblog/?p=556</guid>
		<description><![CDATA[Hello readers A few minutes ago, I had a situation where For example you have a string which is like &#8220;cat,cow,hamster,owl,&#8221; and you want to remove the last comma from the string then you can use this code &#60;?php $string="cat,cow,hamster,owl,"; echo $string."&#60;br/&#62;"; $string= substr($string, 0, strlen($string)-1); echo $string; ?&#62; This comes really handy in many [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.fahdmurtaza.com%2Fmyblog%2F2008%2F11%2F25%2Fphp-how-to-rewmove-last-comma-from-a-string.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.fahdmurtaza.com%2Fmyblog%2F2008%2F11%2F25%2Fphp-how-to-rewmove-last-comma-from-a-string.html&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Hello readers</p>
<p>A few minutes ago, I had a situation where</p>
<p>For example you have a string which is like &#8220;cat,cow,hamster,owl,&#8221;</p>
<p>and you want to remove the last comma from the string</p>
<p>then you can use this code</p>
<p><code>&lt;?php<br />
$string="cat,cow,hamster,owl,";<br />
echo $string."&lt;br/&gt;";<br />
$string= substr($string, 0, strlen($string)-1);<br />
echo $string;<br />
?&gt;</code></p>
<p>This comes really handy in many situations.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fahdmurtaza.com/myblog/2008/11/25/php-how-to-rewmove-last-comma-from-a-string.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax loading button/ bar/ icon gif animation maker/generator with configurable background and foreground color</title>
		<link>http://www.fahdmurtaza.com/myblog/2007/12/10/ajax-loading-button-bar-gif-animation-maker-with-configurable-background-and-foreground-color.html</link>
		<comments>http://www.fahdmurtaza.com/myblog/2007/12/10/ajax-loading-button-bar-gif-animation-maker-with-configurable-background-and-foreground-color.html#comments</comments>
		<pubDate>Mon, 10 Dec 2007 18:12:55 +0000</pubDate>
		<dc:creator>Fahd Murtaza</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Open Source Icons]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Tips]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Development Software]]></category>

		<guid isPermaLink="false">http://www.fahdmurtaza.com/myblog/2007/12/10/ajax-loading-button-bar-gif-animation-maker-with-configurable-background-and-foreground-color.html</guid>
		<description><![CDATA[You are a web surfer right? Thats how you stumbled upon my site. You can rate this post by clicking on these rating stars with this post and yeah you see that cool when you rate a post here. Its an Ajax script working on the background showing you the nice status bar message with [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.fahdmurtaza.com%2Fmyblog%2F2007%2F12%2F10%2Fajax-loading-button-bar-gif-animation-maker-with-configurable-background-and-foreground-color.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.fahdmurtaza.com%2Fmyblog%2F2007%2F12%2F10%2Fajax-loading-button-bar-gif-animation-maker-with-configurable-background-and-foreground-color.html&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>You are a web surfer right? Thats how you stumbled upon my site. You can rate this post by clicking on these rating stars with this post and yeah you see that cool <img src="http://www.fahdmurtaza.com/myblog/wp-content/plugins/postratings/images/loading.gif" border="0" /> when you rate a post here. Its an Ajax script working on the background showing you the nice status bar message with this icon. Its interactive and a good usable thing for your own Ajax script. Wanna make one like that for your ajax stuff? Yeah you can do so on the web!</p>
<p><a href="http://www.fahdmurtaza.com/myblog/2007/12/10/ajax-loading-button-bar-gif-animation-maker-with-configurable-background-and-foreground-color.html/ajax-loading-gif-generator-create-easily-your-own-ajax-loader-icon/" rel="attachment wp-att-88" title="Ajax loading gif generator Create easily your own ajax loader icon"></a></p>
<p style="text-align: center"><a href="http://www.fahdmurtaza.com/myblog/2007/12/10/ajax-loading-button-bar-gif-animation-maker-with-configurable-background-and-foreground-color.html/ajax-loading-gif-generator-create-easily-your-own-ajax-loader-icon/" rel="attachment wp-att-88" title="Ajax loading gif generator Create easily your own ajax loader icon"><img src="http://www.fahdmurtaza.com/myblog/wp-content/uploads/2007/12/ajax-loading-gif-generator-create-easily-your-own-ajax-loader-icon.jpg" alt="Ajax loading gif generator Create easily your own ajax loader icon" /></a></p>
<p>Keep on reading to find the link to the amazing site!<span id="more-87"></span></p>
<h2> Ajax loading gif generator Create easily your own ajax loader icon</h2>
<p>You don&#8217;t need any special gif animation tool for that. All you have to do is go to <a href="http://www.ajaxload.info/" title="http://www.ajaxload.info/" target="_blank">this website</a> and create one for you with customizable colors. It generates the animation gif on the fly that you can right click and save to your computer and later on use in your Ajax solutions. Its a nice thing and a great web 2.0 application. I give 100% to usability, 90% to design, 95% to ease of use and 101% for sharing his work free of cost! But I am sorry his blog is not in English! Anyhow enjoy the cool thing and do rate this post for me so I know how may users used this thing!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fahdmurtaza.com/myblog/2007/12/10/ajax-loading-button-bar-gif-animation-maker-with-configurable-background-and-foreground-color.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP: for loop or foreach loop with mutiple arrays. Multiple arrays in a single foreach loop</title>
		<link>http://www.fahdmurtaza.com/myblog/2007/12/06/php-for-loop-or-foreach-loop-with-mutiple-arrays-multiple-arrays-in-a-single-foreach-loop.html</link>
		<comments>http://www.fahdmurtaza.com/myblog/2007/12/06/php-for-loop-or-foreach-loop-with-mutiple-arrays-multiple-arrays-in-a-single-foreach-loop.html#comments</comments>
		<pubDate>Thu, 06 Dec 2007 09:54:45 +0000</pubDate>
		<dc:creator>Fahd Murtaza</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Tips]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.fahdmurtaza.com/myblog/2007/12/06/php-for-loop-or-foreach-loop-with-mutiple-arrays-multiple-arrays-in-a-single-foreach-loop.html</guid>
		<description><![CDATA[Here is an example for toy to understand the concept of multiple arrays in a single loop in PHP. My friend and coworker Mohammad Khan (yeah he is from Peshawar and sits beside me in the office where we develop web applications) was working on a such a situation for an airline scheduling system for [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.fahdmurtaza.com%2Fmyblog%2F2007%2F12%2F06%2Fphp-for-loop-or-foreach-loop-with-mutiple-arrays-multiple-arrays-in-a-single-foreach-loop.html"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.fahdmurtaza.com%2Fmyblog%2F2007%2F12%2F06%2Fphp-for-loop-or-foreach-loop-with-mutiple-arrays-multiple-arrays-in-a-single-foreach-loop.html&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p style="margin: 5px 20px 20px">Here is an example for toy to understand the concept of multiple arrays in a single loop in PHP. My friend and coworker Mohammad Khan (yeah he is from Peshawar and sits beside me in the office where we develop web applications) was working on a such a situation for an airline scheduling system for <a href="http://www.intercontinentalairways.eu/" title="Intercontinental Airways is available to assist your charter needs. We offer long-term and short-term ACMI contracts." target="_blank">Intercontinental Airways</a> with HTML form submission in PHP where he has multiple arrays passed as POST variables. So I did a quick search on internet and found solutions spread across the forums. I decided to do the quick and dirty mash up of all the stuff with proper editing to get you guys going on the same path along!<span id="more-77"></span></p>
<p style="margin: 5px 20px 20px"> Lets suppose you have two arrays one for links and other for the link name. You want to us a single foreach to mash them up. Have a look</p>
<p class="smallfont" style="margin-bottom: 2px">PHP Code:</p>
<p class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; height: 50px; text-align: left"><code style="white-space: nowrap"><!-- php buffer start --><code><span style="color: #000000"><span style="color: #0000bb">$href </span><span style="color: #007700">= array(</span><span style="color: #dd0000">'htmlfile.html'</span><span style="color: #007700">, </span><span style="color: #dd0000">'giffile.gif'</span><span style="color: #007700">, </span><span style="color: #dd0000">'phpfile.php'</span><span style="color: #007700">, </span><span style="color: #dd0000">'thejpglink.jpg'</span><span style="color: #007700">);<br />
</span><span style="color: #0000bb">$name </span><span style="color: #007700">= array(</span><span style="color: #dd0000">'My html file'</span><span style="color: #007700">, </span><span style="color: #dd0000">'My gif file'</span><span style="color: #007700">, </span><span style="color: #dd0000">'My php file'</span><span style="color: #007700">, </span><span style="color: #dd0000">'My jpeg file'</span><span style="color: #007700">);<br />
</span><span style="color: #0000bb"></span></span></code><!-- php buffer end --></code></p>
<p>You might be thinking, &#8220;How  do I make it so that I can combine both arrays to make a link?&#8221;. Yeah thats what I am gonna teach you guys. Oh I forgot to mention the gals <img src='http://www.fahdmurtaza.com/myblog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Yep ladies I heard you saying, &#8220;I want the  output to be:</p>
<p style="margin: 5px 20px 20px">&nbsp;</p>
<p class="smallfont" style="margin-bottom: 2px">PHP Code:</p>
<p class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; height: 82px; text-align: left"><code style="white-space: nowrap"><!-- php buffer start --><code><span style="color: #000000"><span style="color: #0000bb"></span><span style="color: #007700">&lt;</span><span style="color: #0000bb">a href</span><span style="color: #007700">=</span><span style="color: #dd0000">"</span></span></code></code><code style="white-space: nowrap"><code><span style="color: #000000"><span style="color: #dd0000">htmlfile.html</span></span></code></code><code style="white-space: nowrap"><code><span style="color: #000000"><span style="color: #dd0000">"</span><span style="color: #007700">&gt;</span><span style="color: #0000bb">My html file</span><span style="color: #007700">&lt;/</span><span style="color: #0000bb">a</span><span style="color: #007700">&gt;<br />
&lt;</span><span style="color: #0000bb">a href</span><span style="color: #007700">=</span><span style="color: #dd0000">"giffile.gif"</span><span style="color: #007700">&gt;</span><span style="color: #0000bb">My gif file</span><span style="color: #007700">&lt;/</span><span style="color: #0000bb">a</span><span style="color: #007700">&gt;<br />
&lt;</span><span style="color: #0000bb">a href</span><span style="color: #007700">=</span><span style="color: #dd0000">"phpfile.php"</span><span style="color: #007700">&gt;</span><span style="color: #0000bb">My php file</span><span style="color: #007700">&lt;/</span><span style="color: #0000bb">a</span><span style="color: #007700">&gt;<br />
&lt;</span><span style="color: #0000bb">a href</span><span style="color: #007700">=</span><span style="color: #dd0000">"thejpglink.jpg"</span><span style="color: #007700">&gt;</span><span style="color: #0000bb">My jpg file</span><span style="color: #007700">&lt;/</span><span style="color: #0000bb">a</span><span style="color: #007700">&gt;<br />
</span><span style="color: #0000bb"></span></span></code><!-- php buffer end --></code></p>
<p>. And I want to do this with a single foreach&#8221;.</p>
<p>Thoughts: Do you still think For  only works with one array? Yeah you are wrong!</p>
<p>In both, assume that $ar1 is the first array, and $ar2 is the second  array.</p>
<p>echo $ar1[$n].$ar2[$n]; means echo the value of that part of the  first array, then that part of the second array. You could place them into links  as you wish.</p>
<p style="margin: 5px 20px 20px">&nbsp;</p>
<p class="smallfont" style="margin-bottom: 2px">PHP Code:</p>
<p class="alt2" dir="ltr" style="border: 1px inset ; margin: 0px; padding: 6px; overflow: auto; height: 98px; text-align: left"><code style="white-space: nowrap"><!-- php buffer start --><code><span style="color: #000000"><span style="color: #0000bb"></span><span style="color: #007700">for (</span><span style="color: #0000bb">$n</span><span style="color: #007700">=</span><span style="color: #0000bb">0</span><span style="color: #007700">; isset(</span><span style="color: #0000bb">$ar1</span><span style="color: #007700">[</span><span style="color: #0000bb">$n</span><span style="color: #007700">]) &amp;&amp; isset(</span><span style="color: #0000bb">$ar2</span><span style="color: #007700">[</span><span style="color: #0000bb">$n</span><span style="color: #007700">]; </span><span style="color: #0000bb">$n</span><span style="color: #007700">++) { </span><span style="color: #ff8000">//for loop:<br />
//set $n to zero first time<br />
//while both the $ar1 and $ar2 at $n are set, like $ar2[7], etc.<br />
</span><span style="color: #007700">echo </span><span style="color: #0000bb">$ar1</span><span style="color: #007700">[</span><span style="color: #0000bb">$n</span><span style="color: #007700">].</span><span style="color: #0000bb">$ar2</span><span style="color: #007700">[</span><span style="color: #0000bb">$n</span><span style="color: #007700">];<br />
}<br />
</span><span style="color: #0000bb"></span></span></code></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fahdmurtaza.com/myblog/2007/12/06/php-for-loop-or-foreach-loop-with-mutiple-arrays-multiple-arrays-in-a-single-foreach-loop.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
