Re: Question about Julie Meloni tutorial
| From: | Julie Meloni | Date: | Fri, 07 Jul 2000 14:12:25 +0000 |
| Subject: | Re: Question about Julie Meloni tutorial | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-5385@lists.php.net to get a copy of this message | ||
I would ask that you (or anyone) ask _me_ about things I've written; not
everyone in the world reads them, and won't know what you're talking
about. Plus, it's my responsibility as the author to clarify anything
that is unclear (or just plain problematic) to the person reading X
item. You want to see my inbox? :)
I answer all questions that are asked of me, believe it or
not...soemtimes it takes some time, with a real job and all, but they
are answered (If they're in English...(sorry))
So, that being said....
> $line = explode("\n", $file_contents);
This line explodes on a newline character. You can explode on the
newline character plus a carriage return: \r\n Or, just a carriage
return: \r. Or add a ":" to the end of the line and explode on that.
The point was to split a line on _something_. Depending on file types
and operating systems (does anyone besides me wish that "text" was just
"text"?), "end of line" can mean different things. Try things until
they work for you...There are about a zillion different ways to achieve
the split-by-line, check things sequence. My tutorials usually do it a
very verbose manner, so as to make a point.
> Why do I have to use (sizeof($line)-1) to get the right count?
Because there's something extra at the end of the file. Pat yourself on
the back and go with it, if it works for you. Really.
Just to muse for a second (gee Richard, aren't you glad you asked about
a tutorial now? :))...I know that I as an author, and hopefully others
as well, don't write things to say "this is how you do X", because _I_
know X, Y and Z. This is computing: X Y and Z never stay the same, and
what about A B and C? or D E and F?
Tutorials tutor - show an example of something to someone that didn't
previously know...hopefully it's an empowerment of sorts to learn a
concept and apply your own methods to it. You put 10 programmers in a
room, and telling them to write a script to count to 10, and you'll get
10 different ways to do it.
And I'll shut up now.
+------------------------------------------------+
| Julie Meloni (jcm@i2ii.com) |
| Tech. Director, i2i Interactive (www.i2ii.com) |
| |
| "PHP Essentials" & "PHP Fast & Easy" |
| http://www.thickbook.com/ |
+------------------------------------------------+