Code Snippets

  

PHP Source Code


Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 107,400 PHP Programmers for FREE! Ask your question and get quick answers from experts. There are 1,158 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! 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: 8,611

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.





Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month