Re: general question on Globals

From: Date: Wed, 12 Feb 2003 22:27:24 +0000
Subject: Re: general question on Globals
Groups: php.windows 
Request: Send a blank email to php-windows+get-18503@lists.php.net to get a copy of this message
Hi Dash, Yup here's the function cal and the function: if (projectLatLon($lat,$lon)) { ...do stuff } else { ..do other stuff } function projectLatLon($lat,$lon) { GLOBAL $lccXY; $dlat = doubleval($lat); $dlon = doubleval($lon); //project from geodetic coordinate degrees $parms1[0] = "proj=longlat"; $parms1[1] = "ellps=GRS80"; $parms1[2] = "datum=NAD83"; $parms1[3] = "no_defs"; $projLonLat = pj_init($parms1); //project to lambert conical x,y $parms2[0] = "proj=lcc"; $parms2[1] = "ellps=GRS80"; $parms2[2] = "datum=NAD83"; $parms2[3] = "lat_0= 49.0"; $parms2[4] = "lon_0= -95.0"; $parms2[5] = "lat_1= 49.0"; $parms2[6] = "lat_2= 77.0"; $parms2[7] = "units=m"; $projLCC = pj_init($parms2); $lccXY = pj_transform($projLonLat, $projLCC, $dlon, $dlat,0 ); if ($lccXY == 0) { pj_free($pj); return FALSE; } else { pj_free($pj); return TRUE; } } thx, Paul
From: Dash McElroy <php@l1te.net> To: Paul Dymecki <pdymecki@hotmail.com> Subject: Re: [PHP-WIN] general question on Globals Date: Wed, 12 Feb 2003 14:07:01 -0800 (PST) Do you have an example of the function (or requirements) you need to pass along? I've got lots of functions I use in multiple files that call one include file. Works just fine. Unfortunately, I have almost no experience with PHP Classes. I need to learn, but I have not yet had a chance to split my mind apart and learn the concepts behind it. It does not help that PHP's OO stuff is a little bit weak compared to other languages (from what I have heard). -Dash Travel important today; Internal Revenue men arrive tomorrow. On Wed, 12 Feb 2003, Paul Dymecki wrote: I guess i'm not out of the woods, What i'm actually trying to do is re-use a function across php files which isn't working to well. I'm not sure if i'll have to declare a class. In any case what i'm tryin to do is an ordinary function call passing in 2 arguments and getting one return value. I know how to declare classes(i've been working in java for the past few years) but i don't get php's calling structure. Any help would be appreciated. thx, Paul
From: Dash McElroy <php@l1te.net> To: Paul Dymecki <pdymecki@hotmail.com> Subject: Re: [PHP-WIN] general question on Globals Date: Wed, 12 Feb 2003 12:21:56 -0800 (PST) More than happy to help. I thought I was going insane last night... -Dash If mathematically you end up with the wrong answer, try multiplying by the page number. On Wed, 12 Feb 2003, Paul Dymecki wrote:
Cool thanks, Paul
From: Dash McElroy <php@l1te.net> To: Paul Dymecki <pdymecki@hotmail.com> CC: php-windows@lists.php.net Subject: Re: [PHP-WIN] general question on Globals Date: Wed, 12 Feb 2003 11:46:47 -0800 (PST) I actually just did this last night. I could not for the life of me
figure
out why my variable wasn't working. Until I remembered it was in a function and I had to do a global $varname; command. Works just fine. -Dash Age before beauty; and pearls before swine. -- Dorothy Parker On Wed, 12 Feb 2003, Paul Dymecki wrote:
I have a general question on Global vars. If you declare a
Global
variable
within a function in a program called x.php. Do you have access
to
this
variable in another program say y.php that has
include_once("x.php")?
thx, Paul Dymecki
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus
_________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail
_________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus

« previous php.windows (#18503) next »