On Wednesday 26 November 2003 04:45, Curtis Maurand wrote:

>   consider the following code (content.txt is tab delimited).
>
> $city = "Ipswitch";
> $content = fopen("content.txt", "r");
> $city_found = 0;
> while (!feof($content) && $city_found == 0)
>   {
>     $my_line = fgets($content, "r");
>     $content_array = explode("\t",$my_line);
>     if ($content_array == $city)

You can't do this comparison, $city is a string and $content_array is an 
array. It's meaningless to compare them.

>       {
>         print("Matched on $content_array[0]");
>         $city_found = 1;
>       }
>   }
> print("$content_array[0]<br>\n");
>
> Here's the trouble.
>
> inside the while loop $content_array is available to me.
> outside the loop $content_array is not available.  What
> am I doing wrong?

How did you confirm this observation?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
/* Fuck me gently with a chainsaw... */
        2.0.38 /usr/src/linux/arch/sparc/kernel/ptrace.c
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to