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??? Link to comment https://forums.phpfreaks.com/topic/37850-solved-1-array-1-function-1-calculation-1-big-headache/ Share on other sites More sharing options...
Destruction Posted February 10, 2007 Share Posted February 10, 2007 $max = market_max($cash); Dest Link to comment https://forums.phpfreaks.com/topic/37850-solved-1-array-1-function-1-calculation-1-big-headache/#findComment-181182 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); Link to comment https://forums.phpfreaks.com/topic/37850-solved-1-array-1-function-1-calculation-1-big-headache/#findComment-181183 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.