<?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>SamplePhpCodes.com &#187; file read</title>
	<atom:link href="http://www.samplephpcodes.com/tag/file-read/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.samplephpcodes.com</link>
	<description>Get PHP Code Help, Sample PHP Scripts,PHP Script Demos</description>
	<lastBuildDate>Mon, 05 Apr 2010 15:39:43 +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 – File Read function</title>
		<link>http://www.samplephpcodes.com/php-tutorials/php-file-functions/php-%e2%80%93-file-read-function/</link>
		<comments>http://www.samplephpcodes.com/php-tutorials/php-file-functions/php-%e2%80%93-file-read-function/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 14:24:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP File Functions]]></category>
		<category><![CDATA[File operations in PHP]]></category>
		<category><![CDATA[file read]]></category>
		<category><![CDATA[Open file in read mode]]></category>
		<category><![CDATA[reading a file in PHP]]></category>

		<guid isPermaLink="false">http://samplephpcodes.com/?p=16</guid>
		<description><![CDATA[File Read fread function is used to read content of a file. file pointer and number of bytes to be read are parameters that fread function required. fread returns string read on success or FALSE on failiure. Example of reading content of a file: &#60;?php $filename = 'example.txt'; if (! ($fp = fopen($filename, 'r') ) [...]]]></description>
			<content:encoded><![CDATA[<p><strong>File Read </strong><br />
 fread function is used to read content of a file. file pointer and number of bytes to be read are  parameters that fread function required. fread returns string read on success or FALSE on failiure.<br />
           Example of reading content of a file:</p>
<pre class="brush: php;">&lt;?php
    $filename = 'example.txt';
    if (! ($fp = fopen($filename, 'r') ) ) {
    echo 'Unable to open file '. $filename;
    }else {
    $file_size = filesize($filename);
    if (  !($contents = fread($fp, $file_size)  ) ) {
    echo 'Error: read operation failed';
    }else{
    echo 'content read is ' . $contents;
    }
    fclose($fp);
    }
   ?&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.samplephpcodes.com/php-tutorials/php-file-functions/php-%e2%80%93-file-read-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP File write function</title>
		<link>http://www.samplephpcodes.com/php-tutorials/php-file-functions/php-file-write-function/</link>
		<comments>http://www.samplephpcodes.com/php-tutorials/php-file-functions/php-file-write-function/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 14:27:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP File Functions]]></category>
		<category><![CDATA[File operations in PHP]]></category>
		<category><![CDATA[file read]]></category>
		<category><![CDATA[Open file in write mode]]></category>
		<category><![CDATA[writing a file in PHP]]></category>
		<category><![CDATA[writing data into a file]]></category>
		<category><![CDATA[writing data to file in PHP]]></category>
		<category><![CDATA[writing text file]]></category>

		<guid isPermaLink="false">http://samplephpcodes.com/?p=20</guid>
		<description><![CDATA[File Write fwrite function is used to write contents to a file. fwrite needs file pointer and contents of type string as parameters. fwrite returns number of bytes written on success , or FALSE on error. Example : &#60;?php $content = 'This content is to test'; if ( is_writable ('example.txt') ){ $fp = fopen ('example.txt', [...]]]></description>
			<content:encoded><![CDATA[<p><strong>File Write </strong><br />
<strong></strong><br />
fwrite function is used to write  contents to a file.  fwrite needs  file pointer and  contents of type  string  as parameters. fwrite returns number of bytes written on<br />
success  , or FALSE on error.<br />
             Example :</p>
<pre class="brush: php;">&lt;?php
    $content =  'This content is to test';
    if ( is_writable ('example.txt') ){
    $fp = fopen ('example.txt', 'w');
    if (  !$fp ){
    echo 'error : coud not open file  example.txt  ';
    }else{
    if (! ( $length  =  fwrite($fp, $content )  )   ){
    echo 'writing to the file failed';
    }else{
    echo 'Content wrote  successfully to the file';
    }
   fclose($fp);
   }
   }
  ?&gt; </pre>
]]></content:encoded>
			<wfw:commentRss>http://www.samplephpcodes.com/php-tutorials/php-file-functions/php-file-write-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Number of lines in a file using php</title>
		<link>http://www.samplephpcodes.com/php-tutorials/php-file-functions/number-of-lines-in-a-file-using-php/</link>
		<comments>http://www.samplephpcodes.com/php-tutorials/php-file-functions/number-of-lines-in-a-file-using-php/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 09:37:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP File Functions]]></category>
		<category><![CDATA[count in file]]></category>
		<category><![CDATA[file read]]></category>
		<category><![CDATA[number of lines]]></category>
		<category><![CDATA[number rows]]></category>
		<category><![CDATA[php count lines file]]></category>
		<category><![CDATA[php file]]></category>
		<category><![CDATA[php read file lines]]></category>
		<category><![CDATA[total lines]]></category>
		<category><![CDATA[total records in a file]]></category>
		<category><![CDATA[unix number lines file]]></category>

		<guid isPermaLink="false">http://www.samplephpcodes.com/?p=403</guid>
		<description><![CDATA[It is not practical to use a database even for a small application. If you have to store a few line&#8217;s of data , then you can go for files. For example consider a small application in which you need to store contact numbers of your friends and you are doing this by writing the [...]]]></description>
			<content:encoded><![CDATA[<p>It is not practical to use a database even for a small application. If you have to store a few line&#8217;s of data , then you can go for files. For example consider a small application in which you need to store contact numbers of your friends and you are doing this by writing the data into a file. So what if you need to get the total number of contacts in your contact list. You may need to read the complete list and match the records to find the total number of records. i will tell you an easier way. If you are saving the contacts line by line, you can go for the total number of lines in the files. This will be the total number of contacts. </p>
<p>            This Tutorial will help you to count the number of lines in a file.Hope this will help you and enjoy <img src='http://www.samplephpcodes.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="brush: php;">
&lt;?php
$file = &quot;your_file.txt&quot;; // it can be any file of your choice
$lines = count(file($file));
echo &quot;There are $lines lines in $file&quot;;
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.samplephpcodes.com/php-tutorials/php-file-functions/number-of-lines-in-a-file-using-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
