Home Tutorial Php Phpfiles PHP function fopen and example

 
 

PHP function fopen and example
Posted on: October 29, 2009 at 12:00 AM
Advertisement
In this segment of PHP tutorial we will learn about the PHP fopen() function and its example

Syntax
file_handler fopen(file_name,file_mode,[path_include,[context]])

  • It opens the given file with the given mode and return the file handler
  • Using this file handler all other file handling functions can be done
  • In write (w) mode it creates a new file ,but not in read(r,r+),append(a)mode.


Example of PHP fopen() Function

Code for PHP fopen() Function
<?php
    $file1=fopen("c:/rose1/ram.txt","r");
    if
(!$file1)
      echo
"file is not existing ";
    else
      echo
"file exists";
?>
Output
file exists
Advertisement

Related Tags for PHP function fopen and example :


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: October 29, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com