<?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 operations in PHP</title>
	<atom:link href="http://www.samplephpcodes.com/tag/file-operations-in-php/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>
	</channel>
</rss>
