Re: " " charactor problem
| From: | CC Zona | Date: | Sun, 21 Jan 2001 15:56:45 +0000 |
| Subject: | Re: " " charactor problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35902@lists.php.net to get a copy of this message | ||
In article <3A6AEDF3.2A58B680@nyroc.rr.com>, ridgeway@nyroc.rr.com (Rick
Ridgeway) wrote:
> > > I grab this line and try to make it an array like this:
> > print "line: $thelinefromfile\n"; //Check the line
> > > $var1 = trim($thelinefromfile);
> > > $var2 = split(" ", $thelinefromfile);
> > > $count = count($var2);
> >
> > Are you sure $thelinefromfile is actually being set correctly?
> >
> > Regards,
> >
> > Sean
>
> Yes
> I print it out it says "Array"
> so i then do
> print $thelinefromfile[0];
> and it prints out the whole line instead of the first field from the
> line...
You're print()ing in the order shown above, right? Print() then trim()
then split()? Because that sounds like you're attempting to do a "split()"
on an array. That function is for turning a string into an array; if it's
already an array, then just get rid of the split() and do your count() on
$thelinefromfile.
--
CC