Xname Posted May 13, 2012 Share Posted May 13, 2012 Hi,Dear Frnds...........................I Hope U r all fine. I am using php.Here is the problem in the Return array from function. This is the code. <?php $store = array(); $test = get_my_links(); print_r($store); function get_my_links() { $my_array = array('e','f','g'); foreach($my_array as $key=> $list) { $store[] = $list; } return $store; } ?> Suppose the array is maked dynamically. please help me..THANKS... Quote Link to comment https://forums.phpfreaks.com/topic/262482-return-array-from-function/ Share on other sites More sharing options...
Barand Posted May 13, 2012 Share Posted May 13, 2012 As you are putting the returned value from your function into $test it would make more sense to print_r ($test); Also, move the line "$store = array();" to the beginning of your function. Quote Link to comment https://forums.phpfreaks.com/topic/262482-return-array-from-function/#findComment-1345148 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.