Code Snippets

  

PHP Source Code


Welcome to Dream.In.Code
Become a PHP Expert!

Join 149,031 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,817 people online right now. Registration is fast and FREE... Join Now!





Reading text files

How to read from a .txt file, and how the infomation should be stored.

Submitted By: RichardSA
Actions:
Rating:
Views: 9,285

Language: PHP

Last Modified: March 4, 2005
Instructions: This will read from the set .txt file in this context:

[Picture 1]
id=1
name="Test Number one!"

This will make id = $data['id'].

Snippet


  1. <?php
  2. // Easy, but usefull.
  3. $downloads = parse_ini_file("downloads.txt", true);
  4. foreach($downloads as $name => $data)
  5. {
  6.    echo $data['id'];
  7.    echo $data['name'];
  8. }
  9. ?>

Copy & Paste


Comments


There are currently no comments for this snippet. Be the first to comment!

Add comment


You must be registered and logged on to </dream.in.code> to leave comments.




Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month