associative array problem

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 4
Joined: Wed Jul 02, 2003 2:23 am

associative array problem

Postby phPMaster » Wed Jul 02, 2003 2:26 am

I call a function with a parameter like this:


How can I get the keyName in the function? I've tried like this, but it didn't work:

function myFunction ($data) {
print key($data);

php-forum Active User
php-forum Active User
Posts: 266
Joined: Tue Apr 08, 2003 5:18 am
Location: Ottawa, Canada

Postby liquedus » Wed Jul 02, 2003 6:00 am

when you call myFunction you are passing it the value at that index.. so the function will only recieve the value and nothing else, you would have to pass in the key as a seperate value, if you need it. :?

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 3 guests