Okay, I was looking over some old scripts. Decided to edit one for a current project. It was a shout box I made awhile ago. I choose to use an array to keep all the posting data. $shout['message'], $shout['ip'], $shout['time'], username is stored elsewhere. It wasn’t working correctly so I decided to start echoing out all the variables.
When I echo'd out $shout['ip'] I received 1. But when I changed the variable to $shoutip, it echo'd out my IP. Same with $shout['time'], do I have to declare something when using numbers in arrays?
Thanks for your help.
Numbers and array's
Moderator: General Moderators
-
anthony88guy
- Forum Contributor
- Posts: 246
- Joined: Thu Jan 20, 2005 8:22 pm
you can do $foo[0] = 1; $foo[1] = 2; etc...
but if you're using associative array like you did then this code is required:
but if you're using associative array like you did then this code is required:
Code: Select all
$foo = array (
"blah" => "1",
"foo" => "2",
);