Advertisement
Guest User

PHP text file to array

a guest
Apr 28th, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.26 KB | None | 0 0
  1. <?php
  2. $file = @fopen("text.txt", "r");
  3.  
  4. if ($file) {
  5.     while (($buffer = fgets($file, 4096)) !== false) {
  6.         $parts = explode('    ', $buffer);
  7.         print_r($parts);
  8.     }
  9.     if (!feof($file)) {
  10.         echo "fgets() failed\n";
  11.     }
  12.     fclose($file);
  13. }
  14. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement