Logo
file handling
Online Now: 1
Snippet Code
<?php
//puts the whole file in an array ($arr) line by line
//$arr = file("data.txt");
//print_r($arr);
//file_put_contents("data.txt","\nNew test", FILE_APPEND);
$f fopen("data.txt","r") or die("Error !!!");
//fputs($f,"\nTest");
echo fread($ffilesize("data.txt"));
//reads one line from the file in question
//echo fgets($f);  
//reads  one line from the file in question but delets html tags (if you read from an html file)
//echo fgetss($f); 
// you can specify the lenth of the string to return, e.g. 255
//echo fgetss($f, 255); 
// you can also specify which tags to ignore (not to delete)
//echo fgetss($f, 255),"<br><a>"; 
//echo '<br>';
//echo fgetc($f);
fclose($f);
?>
 
Snippet Comments

Add Your Comment

No Comments Yet.

Add Your Comment

 
Snippet Tools
Rate this Snippet:

Rate the difficulty level:

Request Snippet Update


Suggested Difficulty Level: No votes yet.
Current Score: No votes yet

Total Views: 211

Other top snippets by maque:

1. Read file or site in a string
2. If else
3. Types of loops (for, foreach, while)
4. put links on homepage only
5. Showing date

Search
Search for:







User Panel

User name:

Password:

Register And Post Your Own Snippets

New Snippets

1.  Shorten text and (4 of 1)

2.  file-based simple guest (0 of 0)

3.  adding an entry (0 of 0)

4.  integer to currency (1.33 of 3)

5.  Aggregate IP addresses (0 of 0)

6.  file handling (0 of 0)

7.  testing system with (0 of 0)

8.  Make an php (1 of 1)

9.  allow download in (5 of 1)

10.  redirect in 3 (0 of 0)

11.  live clock with (0 of 0)

12.  visit counter (3.5 of 2)

13.  contact form with (4 of 1)

14.  show a specific (0 of 0)

15.  The & sign (0 of 0)

16.  static variable in (0 of 0)

17.  multiplication table with (0 of 0)

18.  function with multiplicationt (0 of 0)

19.  php generated menu (0 of 0)

20.  drawing a table (0 of 0)

21.  embedded array (one (0 of 0)

22.  checks the week (0 of 0)

23.  put links on (4.5 of 2)

24.  Directory Image Gallery (0 of 0)

25.  TOS (4 of 1)

Home | Forum | Free PHP Web Hosting | Contact | Terms & Conditions |  
Donate
PHPSnips.com - ©2012 Amethyst Creative