Re: Delimited file values behaving strangely...
| From: | Lowell Allen | Date: | Mon, 10 Feb 2003 16:26:32 +0000 |
| Subject: | Re: Delimited file values behaving strangely... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135086@lists.php.net to get a copy of this message | ||
> From: Geoff Caplan <geoff@advantae.com>
>
> Hi folks,
>
> A strange one - unless I am having a brainstorm...
>
> I am reading in tab delimited files created in Excel on Windows and
> uploaded to Linux.
>
> Cell A1 contains a numeric id - I extract this into a variable, $id,
> by exploding on \n and \t.
>
> But for some files, the values of $id do not behave as expected. Say
> the value should be "23".
>
> If I echo, it prints as "23". But comparisons fail to match:
>
> if( $id == 23 ) ...
>
Try using trim() on the value to get rid of blank spaces, returns, and other
weirdness.
--
Lowell Allen