in reply to **HomeWork** Printing the found input from an array
If you used strict, you'd see why. The scoping of $city is such that it's not available when you declare your array. Somehow you need to keep the appropriate city value after you've found a match. (What if you assigned it to $found, and then checked if $found is empty instead of if it's zero?)
|
|---|