tcollie Posted February 10, 2007 Share Posted February 10, 2007 Okay, I've created a function to calculate the max amount that can be purchased for a market system. It looks like this: function market_max($cash) { include('includes/_config.php'); $max['product_01'] = $cash/$config['product_01']; return $max; } And my includes/_config.php code: $config['product_01'] = 1; And my script: $cash = 1000; market_max($cash); print_r($max); This doesn't output anything. But if I just code it outside the function like this, it works: include('includes/_config.php'); $cash = 1000; $max['product_01'] = $cash/$config['product_01']; print_r($max); Output: Array ( [product_01] => 1000 ) Where am I going wrong??? Quote Link to comment Share on other sites More sharing options...
Destruction Posted February 10, 2007 Share Posted February 10, 2007 $max = market_max($cash); Dest Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted February 10, 2007 Share Posted February 10, 2007 you need either $cash = 1000; print_r(market_max($cash)); or $cash = 1000; $max = market_max($cash); print_r($max); Quote Link to comment 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.