PHP School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

 

Code Snippets

  

PHP Source Code


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

Join 300,470 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,742 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: 10,988

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!

Be Social

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

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month