Page 1 of 1

Another silly newbie type question but important

Posted: Tue Dec 07, 2004 1:05 pm
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;

Posted: Tue Dec 07, 2004 1:18 pm
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.