<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PHP Magic Book - Free PHP Scripts, Tutorials and Downloads &#187; Implode</title>
	<atom:link href="http://www.phpmagicbook.com/category/implode/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpmagicbook.com</link>
	<description>PHP AtoZ Reloaded, free php tutorials, free php downloads, php scripts, PHP tips</description>
	<lastBuildDate>Tue, 15 Jun 2010 13:22:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>PHP &#8211; Implode</title>
		<link>http://www.phpmagicbook.com/php-implode/</link>
		<comments>http://www.phpmagicbook.com/php-implode/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 00:21:54 +0000</pubDate>
		<dc:creator>Hiroshi</dc:creator>
				<category><![CDATA[Implode]]></category>
		<category><![CDATA[PHP Functions]]></category>
		<category><![CDATA[Functions]]></category>

		<guid isPermaLink="false">http://www.phpmagicbook.com/?p=181</guid>
		<description><![CDATA[The PHP function implode operates on an array and is known as the &#8220;undo&#8221; function of explode. If you have used explode to break up a string into pieces or parts or just have an array of stuff you can use implode to put them all into one string. PHP Implode &#8211; Combining Exploded Pieces [...]<p><a href="http://www.phpmagicbook.com/php-implode/">PHP &#8211; Implode</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
]]></description>
			<content:encoded><![CDATA[<p>The PHP function implode operates on an array and is known as the &#8220;undo&#8221; function of explode. If you have used <a href="http://www.phpmagicbook.com/php-explode/">explode</a> to break up a string into pieces or parts or just have an array of stuff you can use implode to put them all into one string.</p>
<p><span id="more-248"></span></p>
<h4>PHP Implode &#8211; Combining Exploded Pieces</h4>
<p>The first argument of implode is the string of characters you want to use to join the array pieces together. The second argument is the array (pieces).</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$pieces</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hello&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;World,&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;I&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;am&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;Here!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$WithSpaces</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pieces</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$WithDashes</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pieces</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pieces</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Piece no <span style="color: #006699; font-weight: bold;">$i</span> = <span style="color: #006699; font-weight: bold;">$pieces</span>[<span style="color: #006699; font-weight: bold;">$i</span>] &lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Combined With Spaces = <span style="color: #006699; font-weight: bold;">$WithSpaces</span> &lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Combined With Dashes = <span style="color: #006699; font-weight: bold;">$WithDashes</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h4>Result</h4>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">Piece no 0 = Hello
Piece no 1 = World,
Piece no 2 = I
Piece no 3 = am
Piece no 4 = Here!
&nbsp;
Combined With Spaces = Hello World, I am Here!
Combined With Dashes = Hello-World,-I-am-Here!</pre></div></div>

<p><a href="http://www.phpmagicbook.com/php-implode/">PHP &#8211; Implode</a> is a post from: <a href="http://www.phpmagicbook.com">PHP Magic Book - Free PHP Scripts, Tutorials and Downloads</a></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.phpmagicbook.com/show-a-part-of-string-substr/" title="Show A Part Of String &#8211; substr in PHP">Show A Part Of String &#8211; substr in PHP</a></li><li><a href="http://www.phpmagicbook.com/function-existence-check/" title="Function Existence Check Using PHP">Function Existence Check Using PHP</a></li><li><a href="http://www.phpmagicbook.com/php-explode/" title="PHP &#8211; Explode">PHP &#8211; Explode</a></li><li><a href="http://www.phpmagicbook.com/php-functions/" title="PHP Functions">PHP Functions</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.phpmagicbook.com/php-implode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.451 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-07-30 16:32:15 -->
