<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[PHP Forums - Comma delimited file]]></title>
	<link rel="self" href="http://www.phpforums.org/feed-atom-topic28.xml"/>
	<updated>2010-08-06T10:03:11Z</updated>
	<generator>PunBB</generator>
	<id>http://phpforums.org/topic28-comma-delimited-file.html</id>
		<entry>
			<title type="html"><![CDATA[Re: Comma delimited file]]></title>
			<link rel="alternate" href="http://phpforums.org/post75.html#p75"/>
			<content type="html"><![CDATA[<p>Hope it helps !!!<br /></p><div class="codebox"><pre><code>&lt;?php
$sContents    =    &quot;Jim,Smith,1234 Main Street,Anytown,NY,12345,206,123-3456\n&quot;;
$sContents    .=    &quot;Aneesh,R,1234 Main Street,Anytown,NY,12345,206,123-3456\n&quot;;
$sContents    .=    &quot;Sambhu,S,1234 Main Street,Anytown,NY,12345,206,123-3456&quot;;

foreach( explode(&quot;\n&quot;, $sContents) as $k=&gt;$sContent ){
    $arrValues    =    explode( &quot;,&quot;, $sContent );
    $arrGlobal[$arrValues[1]][]    =    $arrValues[1] .&quot;,&quot; . $arrValues[0] .&quot;,&quot; . $arrValues[7] ;
}
sort( $arrGlobal );
foreach( $arrGlobal as $Global ){
    echo $Global[0] .&quot;&lt;br&gt;&quot;;
}
?&gt;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[aneeshrp]]></name>
				<uri>http://phpforums.org/user46.html</uri>
			</author>
			<updated>2010-08-06T10:03:11Z</updated>
			<id>http://phpforums.org/post75.html#p75</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Comma delimited file]]></title>
			<link rel="alternate" href="http://phpforums.org/post57.html#p57"/>
			<content type="html"><![CDATA[<p>I have a comma delimited text file with several records. A typical record looks like this:</p><p>Jim,Smith,1234 Main Street,Anytown,NY,12345,206,123-3456</p><p>I need to read the file andd then output the data (name and phone number) in a two columm table like this:</p><p>Smith, Jim&nbsp; &nbsp; &nbsp; &nbsp; (206) 123-3456</p><p>The data also needs to be sorted by last name.</p><p>I assume I will be using an array, but I&#039;m not sure how to do it.</p><p>If you can help me, email me at grz@wi-net.com.</p><p>Thanks,</p><p>Andrew</p>]]></content>
			<author>
				<name><![CDATA[andrewgrz]]></name>
				<uri>http://phpforums.org/user36.html</uri>
			</author>
			<updated>2010-06-06T02:00:09Z</updated>
			<id>http://phpforums.org/post57.html#p57</id>
		</entry>
</feed>

