explode, split, or what?
| From: | Kyle Babich | Date: | Thu, 19 Jun 2003 22:41:00 +0000 |
| Subject: | explode, split, or what? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-152249@lists.php.net to get a copy of this message | ||
Thank you to those of you who helped me with my last problem earlier today.
Now I have a text file (setup.txt) that has a series of values all seperated by \r\n's. Inside
of another file I'm trying to read setup.txt into $rawSetupData and explode that with
\r\n's into an array called $setupData. My problem is that the explode function doesn't
seem to be doing anything, and neither is split which I tried also. Here is my code:
setup.txt
***
John\'s X Log
10
5
example.com
treeclimber56
ab3c45def
***
test.php
***
<?php
if (file_exists("setup.txt")) {
$rawSetupData = readfile("setup.txt");
$setupData = explode("\r\n", $rawSetupData);
echo $setupData[0];
}
else echo "Error opening \"setup.txt\"";
?>
***
Actual results of running test.php
***
John\'s X Log 10 5 example.com treeclimber56 ab3c45def 61
***
Desired reults of running test.php
***
John's X Log
***
Other problem:
In the actual results of running test.php where is the 61 coming from?
Thank you,
--
Kyle