728x15 Ads

bar

PHP overview

PHP Concepts

    What is php ..?
    PHP is probably the most popular scripting language on the web. It is used to enhance web pages.
    PHP has four different variable scopes:
    • local

    • global

    • static

    • parameter

    Learn how to create a website design templating system using php to be able to easily update different sections on your website by changing ...
    COMMING SOON !!
    open files ko reference karne ke liye php file pointer ka use karta hai. we can create a new file pointer by using fopen(). This function takes, at minimum, two parameters: filename is the file that you wish to open, and mode is the mode you wish to open it with. . There are eight different modes that you can use to open a file:
    Mode Description r Open for reading only; place the file pointer at the beginning of the file. r+ Open for reading and writing; place the file pointer at the beginning of the file. w Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. w+ Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. a Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it. a+ Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it. x Create and open for writing only; place the file pointer at the beginning of the file. x+ Create and open for reading and writing; place the file pointer at the beginning of the file. 
    functions required to read a file with PHP. fopen() function. filesize() function. fread() function. fclose() function.
    example!!

    <?php
    $filename = "/home/user/guest/tmp.txt";
    $file = fopen( $filename, "r" );
    if( $file == false )
    {
       echo ( "Error in opening file" );
       exit();
    }
    $filesize = filesize( $filename );
    $filetext = fread( $file, $filesize );

    fclose( $file );

    echo ( "File size : $filesize bytes" );
    echo ( "<pre>$filetext</pre>
    " );
    ?>

Copyright © eAZy EnginEEriNG