jonniejoejonson Posted August 5, 2008 Share Posted August 5, 2008 $a=3; $b=4; i have a function function addUp($a,$b) { $c=$a+$b; return $c; } however is there a way to make $b global so that it doesn't have to be defined in the function? Link to comment https://forums.phpfreaks.com/topic/118310-global-variables/ Share on other sites More sharing options...
trq Posted August 5, 2008 Share Posted August 5, 2008 Generally its poor design but... function addUp($a) { global $b; $c=$a+$b; return $c; } Link to comment https://forums.phpfreaks.com/topic/118310-global-variables/#findComment-608828 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.