Another silly newbie type question but important

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
irishmike2004
Forum Contributor
Posts: 119
Joined: Mon Nov 15, 2004 3:54 pm
Location: Lawrence, Kansas

Another silly newbie type question but important

Post by irishmike2004 »

The following is the current layout of my php script, can I just define the global variables outside the function thereby doing one definition of them, or must I do it like it is already setup.

Thanks

Code: Select all

$currDate = date("l, F j, Y");
$currTemp;
$feelsLike;
$skyCond;
$windSpeed;
$windDir;
$windGust;
$barPressure;
$barState;
$uvIndex;
$uvRisk;
$wIcon;
$celtemp;
$fLikeCel;
$observPost;
$observTime;
$location;
$visability;
$humidity;
$dewpoint;



// gets and parses weather from weather.com 
function getWeatherReport()
{	
	
	global $currTemp;
	global $feelsLike;
	global $skyCond;
	global $windSpeed;
	global $windDir;
	global $windGust;
	global $barPressure;
	global $barState;
	global $uvIndex;
	global $uvRisk;
	global $wIcon;
	global $celTemp;
	global $fLikeCel;
	global $observPost;
	global $observTime;
	global $location;
	global $visability;
	global $humidity;
	global $dewpoint;
irishmike2004
Forum Contributor
Posts: 119
Joined: Mon Nov 15, 2004 3:54 pm
Location: Lawrence, Kansas

Post by irishmike2004 »

tried and got my answer. The answer would be that I have to define the globals inside the function... I suppose I should make this into a class file, but that would require work ;-) Anyhow, mark this one solved.
Post Reply