populating associative array from a function

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: populating associative array from a function

Post by seandisanti » Sat Mar 29, 2014 1:04 am

Your challenge is coming from the scope of the variable containing the array. If you're declaring it outside of the function, make sure you use global $variableName; in the function to specify that you're going to be referencing th global variable rather than one in local scope. if the variable is defined locally to the function (inside the function) then you'd have to return it to the calling context in order to make the results available

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest