Re: [PHP] charactor problem

2001-01-21 Thread CC Zona

In article [EMAIL PROTECTED], [EMAIL PROTECTED] (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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] charactor problem

2001-01-20 Thread Rick Ridgeway

im trying to build an array from an entry in a file and im having some
trouble with it.

in a file i have a line similar to:
1234 hello 123456 12345678

I grab this line and try to make it an array like this:
$var1 = trim($thelinefromfile);
$var2 = split(" ", $thelinefromfile);
$count = count($var2);

$count comes out to equal 1
so, it doesnt actually see each space as the seperator therefore it sees it
as one field..
Ive also tried split("\ ", $thelinefromfile);
but, that doesnt work either...
ive tried ereg_replace($space, $commathenspace, $thelinefromfile);
that also does not seem to work

Please help...

Thanks in advance

Rick


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] charactor problem

2001-01-20 Thread Sean Cazzell

 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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]