<?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>File Handling Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/file-handling/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/file-handling/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Tue, 17 Aug 2021 12:34:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Tutorial for Closing File in PHP</title>
		<link>https://www.scmgalaxy.com/tutorials/tutorial-for-closing-file-in-php/</link>
					<comments>https://www.scmgalaxy.com/tutorials/tutorial-for-closing-file-in-php/#respond</comments>
		
		<dc:creator><![CDATA[Ashwani Kumar]]></dc:creator>
		<pubDate>Tue, 17 Aug 2021 12:34:40 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[Closing File function in file handling in php]]></category>
		<category><![CDATA[Closing File function in PHP]]></category>
		<category><![CDATA[Closing File in PHP]]></category>
		<category><![CDATA[fclose( )]]></category>
		<category><![CDATA[fclose( ) function]]></category>
		<category><![CDATA[File Handling]]></category>
		<category><![CDATA[File Handling in PHP]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[PHP Function]]></category>
		<category><![CDATA[php function closing file]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[What]]></category>
		<category><![CDATA[What is fclose( ) Function in php?]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=8036</guid>

					<description><![CDATA[<p>Closing file in php is all related to fclose( ) Function. With the help of this code we can run [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorial-for-closing-file-in-php/">Tutorial for Closing File in PHP</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Closing file in php is all related to <code><span class="has-inline-color has-vivid-red-color">fclose( )</span></code> Function. With the help of this code we can run closing function in php.</p>



<h3 class="wp-block-heading">What is fclose( ) Function in php?</h3>



<p class="wp-block-paragraph">In PHP, the <code><span class="has-inline-color has-vivid-red-color"><strong>fclose()</strong></span></code> method is used to close a file referenced by an open file pointer. If the method <code><span class="has-inline-color has-vivid-red-color"><strong>fclose()</strong></span></code> is successful, it returns true; otherwise, it returns false. It accepts the file that needs to be closed as an input and closes it.</p>



<p class="wp-block-paragraph"><strong>Syntax:</strong></p>



<pre class="wp-block-code"><code><span class="has-inline-color has-vivid-red-color"><strong>bool fclose( $file )</strong></span></code></pre>



<p class="wp-block-paragraph"><strong>Parameters:</strong></p>



<p class="wp-block-paragraph">The $file argument is the only one accepted by PHP&#8217;s <code><span class="has-inline-color has-vivid-red-color"><strong>fclose()</strong></span></code> function. The file that has to be closed is specified by this argument.</p>



<p class="wp-block-paragraph"><strong>Return Value:</strong></p>



<p class="wp-block-paragraph">If it succeeds, it returns true; if it fails, it returns false.</p>



<p class="wp-block-paragraph"><strong>Errors And Exception</strong>:</p>



<ul class="wp-block-list"><li>If you want to read the contents of a file that was written using the <code><span class="has-inline-color has-vivid-red-color"><strong>fwrite()</strong></span></code> function, you must first shut it with the <code><span class="has-inline-color has-vivid-red-color"><strong>fclose()</strong></span></code> function.</li><li>For remote files, PHP&#8217;s fclose() method does not work. It only works with files that the server&#8217;s filesystem can access.</li></ul>



<p class="wp-block-paragraph"><strong>Let&#8217;s take examples to explain this function:</strong></p>



<pre class="wp-block-code"><code>Input : $check = fopen("gfg.txt", "r");
        fclose($check);
Output : true

Input: $check = fopen("singleline.txt", "r");
       $seq = fgets($check);
       while(! feof($check))
       {
         echo $seq ;
         $seq = fgets($check);
       }
       fclose($check);
Output:true</code></pre>



<p class="wp-block-paragraph"><strong>Example 1:-</strong> </p>



<script src="https://gist.github.com/AdarshAshwani/0ac4d7d9342d58c7b1c7c839cbb52ac4.js"></script>



<p class="wp-block-paragraph"><strong>Output:</strong>&#8211;</p>



<figure class="wp-block-image size-full"><img decoding="async" width="91" height="40" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-128.png" alt="" class="wp-image-8049"/></figure>



<p class="wp-block-paragraph"><strong>Example 2</strong>:- The file test.txt in the software below includes just one line: &#8220;This file contains only one line.&#8221;</p>



<script src="https://gist.github.com/AdarshAshwani/394cb1188f6b4989e4292d7d0774070f.js"></script>



<p class="wp-block-paragraph"><strong>Output:</strong>&#8211;</p>



<figure class="wp-block-image size-full"><img decoding="async" width="439" height="55" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-129.png" alt="" class="wp-image-8051" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-129.png 439w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-129-300x38.png 300w" sizes="(max-width: 439px) 100vw, 439px" /></figure>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorial-for-closing-file-in-php/">Tutorial for Closing File in PHP</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/tutorial-for-closing-file-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Tutorial for Reading file on File Handling in PHP</title>
		<link>https://www.scmgalaxy.com/tutorials/tutorial-for-reading-file-on-file-handling-in-php/</link>
					<comments>https://www.scmgalaxy.com/tutorials/tutorial-for-reading-file-on-file-handling-in-php/#respond</comments>
		
		<dc:creator><![CDATA[Ashwani Kumar]]></dc:creator>
		<pubDate>Fri, 13 Aug 2021 12:40:54 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[File Handling]]></category>
		<category><![CDATA[File Handling in PHP]]></category>
		<category><![CDATA[How]]></category>
		<category><![CDATA[How many types of PHP file Read Functions are]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[PHP readfile() Function]]></category>
		<category><![CDATA[php tutorial]]></category>
		<category><![CDATA[readfile()]]></category>
		<category><![CDATA[Reading file]]></category>
		<category><![CDATA[Reading file on File Handling]]></category>
		<category><![CDATA[types of PHP file Read Functions]]></category>
		<category><![CDATA[What]]></category>
		<category><![CDATA[What is Reading file on File Handling]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7923</guid>

					<description><![CDATA[<p>What is Reading file on File Handling? PHP has a number of functions for reading data from files. You may [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorial-for-reading-file-on-file-handling-in-php/">Tutorial for Reading file on File Handling in PHP</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3 class="wp-block-heading">What is Reading file on File Handling?</h3>



<p class="wp-block-paragraph">PHP has a number of functions for reading data from files. You may read entire file data, read data line by line, or read data character by character using various methods.</p>



<h3 class="wp-block-heading">How many types of PHP file Read Functions are:-</h3>



<p class="wp-block-paragraph">The available PHP file read functions are given below.</p>



<ul class="wp-block-list"><li>fread()</li><li>fgets()</li><li>feof()</li></ul>



<h3 class="wp-block-heading">PHP readfile() Function</h3>



<p class="wp-block-paragraph">Reads a file and publishes it to the output buffer with the <code><span class="has-inline-color has-vivid-red-color"><strong>readfile()</strong></span></code> method.</p>



<p class="wp-block-paragraph">Assume we have a text file on the server named &#8220;webdictionary.txt&#8221; that looks like this:</p>



<pre class="wp-block-code"><code>AJAX = Asynchronous JavaScript and XML
CSS = Cascading Style Sheets
HTML = Hyper Text Markup Language
PHP = PHP Hypertext Preprocessor
SQL = Structured Query Language
SVG = Scalable Vector Graphics
XML = EXtensible Markup Language</code></pre>



<p class="wp-block-paragraph">The following is the PHP code for reading the file and writing it to the output buffer (the <code><span class="has-inline-color has-vivid-red-color"><strong>readfile() </strong></span></code>method returns the number of bytes read if successful):</p>



<p class="wp-block-paragraph"><strong>Example:-</strong></p>



<script src="https://gist.github.com/AdarshAshwani/f98f625c37a8287ba3319b38ec771a4f.js"></script>



<p class="wp-block-paragraph">If all you want to do is open a file and read its contents, the <code><span class="has-inline-color has-vivid-red-color"><strong>readfile()</strong></span></code> method comes in handy.</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorial-for-reading-file-on-file-handling-in-php/">Tutorial for Reading file on File Handling in PHP</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/tutorial-for-reading-file-on-file-handling-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Tutorial for Opening file on File Handling in PHP</title>
		<link>https://www.scmgalaxy.com/tutorials/tutorial-for-opening-file-on-file-handling-in-php/</link>
					<comments>https://www.scmgalaxy.com/tutorials/tutorial-for-opening-file-on-file-handling-in-php/#respond</comments>
		
		<dc:creator><![CDATA[Ashwani Kumar]]></dc:creator>
		<pubDate>Mon, 09 Aug 2021 13:09:54 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[File Handling]]></category>
		<category><![CDATA[File Handling in PHP]]></category>
		<category><![CDATA[Opening file]]></category>
		<category><![CDATA[Opening file on File Handling in PHP]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Tutorial for Opening file on File Handling in PHP]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7651</guid>

					<description><![CDATA[<p>Opening file on File Handling in PHP fopen( ) – This function is used to open a file or URL. [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorial-for-opening-file-on-file-handling-in-php/">Tutorial for Opening file on File Handling in PHP</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h3 class="wp-block-heading">Opening file on File Handling in PHP</h3>



<div class="wp-block-image"><figure class="aligncenter"><img decoding="async" src="http://www.easytolearning.com/webroot/ck_files/files/file-handling-in-php.png" alt="PHP File Handling, Create, Open, Read, Write, Append"/></figure></div>



<p class="wp-block-paragraph">fopen( ) – This function is used to open a file or URL.</p>



<p class="wp-block-paragraph"><strong>Syntax:-</strong> </p>



<p class="wp-block-paragraph">fopen(filename, mode, include_path, context)<br>File name – It is the name of file or url.<br>Mode – in which mode we want to open this file ex: &#8211; r, w etc.<br>Include_path – Set this parameter to ‘1’ or TRUE to specify that you want to search for the file in the PHP include path.<br>Context – Contexts modify or enhance the behavior of the data stream from and to files.</p>



<p class="wp-block-paragraph"><strong>If the open operation fails, it returns FALSE and an error on failure.</strong></p>



<p class="wp-block-paragraph"><strong>Example:-</strong></p>



<script src="https://gist.github.com/AdarshAshwani/31600df5e8dab33890d2971f18b00c14.js"></script>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/tutorial-for-opening-file-on-file-handling-in-php/">Tutorial for Opening file on File Handling in PHP</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/tutorial-for-opening-file-on-file-handling-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
