[nycphp-talk] Parse error setting an array - why?
Analysis & Solutions
danielc at analysisandsolutions.com
Fri May 30 12:02:19 EDT 2003
On Fri, May 30, 2003 at 11:52:06AM -0400, soazine at pop.erols.com wrote:
> Ok I will do the best I can, although it won't make the problem clearer (at
> least to me):
It absolutely helps.
> Warning: Invalid argument supplied for foreach() in
> /users/ppowell/web/profile/display.php on line 92
>
> Line 92:
> foreach ($browser as $key => $val)
> echo "$key = $val<br>";
I'll bet $browser isn't an array.
> Furthermore I do not understand
>
> $browserArray = array($key, $val);
Dude, did you write the exact syntax I wrote? No.
The syntax you wrote makes an enumerated array with two values. What I
think you really want to be doing is creating an associative array with
one key value pair. Right? So, use "$key => $val" instead of "$key,
$val"
But, since you're pulling stuff from the $browser array already, why are
you creating a second array with the same exact data? I suspect you're
off course...
> I have never seen that before
The manual is an excellent resource. Have you looked at the array
section? Finding it is as simple as typing "php.net/array" into most web
browsers.
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
More information about the talk
mailing list