Results 1 to 1 of 1
  1. #1
    peam
    peam is offline
    Guest
    Join Date
    2013 Nov
    Posts
    3
    Thanks Thanks Given 
    0
    Thanks Thanks Received 
    0
    Thanked in
    0 Posts
    Rep Power
    0

    Red face Read / Write File with PHP

    I will show you how PHP read / write file.

    example.txt
    PHP Code:
    0
    1
    2
    3
    4
    5
    6
    7
    8


    PHP Code:
    <?php
    // at first read content from file example.txt
    $strFileName "example.txt";
    $objFopen fopen($strFileName'r');
    while (!
    feof($objFopen)) {
        
    $lines[] = fgets($objFopen4096);
    }
    fclose($objFopen);

    // now we will edit content from example.txt and write to a new file new_example.txt
    $strFileName "new_example.txt";
    $objFopen fopen($strFileName'w');
    foreach (
    $lines as $k=>$v) {
        
    fwrite($objFopen, ($v+1)."\r\n");
    }
    fclose($objFopen);
    ?>
    output new_example.txt
    PHP Code:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10 
    Hope this help.

Similar Threads

  1. [C#] Yet Another Simple Write / Read Memory Class
    By TheTime in forum VB, .NET Framework
    Replies: 0
    Last Post: 2012-12-07, 03:39 PM
  2. [C#] class Read/Write Memory in C#
    By bigbozz in forum Perfect World Bots, Cheats
    Replies: 0
    Last Post: 2012-12-02, 09:08 AM
  3. Simple VB Write/Read Memory Class
    By Dwar in forum VB, .NET Framework
    Replies: 3
    Last Post: 2012-07-22, 05:11 PM
  4. [C#] How to Read and Write to the Process Memory
    By Grooguz in forum VB, .NET Framework
    Replies: 0
    Last Post: 2011-11-27, 05:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •