[PHP-WIN] Need Help with Classes From: Paul Dymecki (pdymecki <email protected>)
Date: 02/12/03

Ya it seems like a pain indeed. I guess i'll pose the question though:
for the following class

class myClass
{
var myVar;
function myFunc($myVarA,$myVarB)
{
   ....
   $this -> myVar = array("b" => 55,"c" => 66);
}
}

Now i try
$somveVar = new myClass();

and finally i try and acces myVar from outside the class:

$x = ($someVar->$myVar["u"]);
$y = ($someVar->$myVar["v"]);

Nada, rien, nicht, no dice...
Any help would be appreciated,

Paul

>From: "Matt Hillebrand" <matt <email protected>>
>To: "'Paul Dymecki'" <pdymecki <email protected>>
>Subject: OOP in PHP
>Date: Wed, 12 Feb 2003 16:50:12 -0600
>
>I like OOP as well. I'm a big fan of Java. However, I'm waiting for PHP
>5 to do any OO in PHP since it's so limited in the current version.
>
>
>|-----Original Message-----
>|From: Paul Dymecki [mailto:pdymecki <email protected>]
>|Sent: Wednesday, February 12, 2003 4:47 PM
>|To: matt <email protected>
>|Subject: RE: [PHP-WIN] general question on Globals
>|
>|
>|Thanks that clears things up a bit, i may go with classes in
>|any case. Paul
>|
>|
>|
>|>From: "Matt Hillebrand" <matt <email protected>>
>|>To: "'Paul Dymecki'" <pdymecki <email protected>>
>|>Subject: RE: [PHP-WIN] general question on Globals
>|>Date: Wed, 12 Feb 2003 15:50:38 -0600
>|>
>|>Functions in PHP behave just like those in C, Perl, and Java
>|(methods).
>|>I noticed you said that you "declared a global variable inside a
>|>function." You don't "declare" a global variable inside a
>|function, you
>|>use the global keyword inside a function to tell PHP to look in the
>|>global scope for that variable.
>|>
>|>For Example:
>|>
>|><?
>|> $x = 444; // this is a variable in the global scope
>|>
>|> function my_func() {
>|> global $x;
>|> print $x; // prints "444"
>|> }
>|>?>
>|>
>|>Matt
>|>
>|>|-----Original Message-----
>|>|From: Paul Dymecki [mailto:pdymecki <email protected>]
>|>|Sent: Wednesday, February 12, 2003 3:44 PM
>|>|To: php <email protected>
>|>|Cc: php-windows <email protected>
>|>|Subject: Re: [PHP-WIN] general question on Globals
>|>|
>|>|
>|>|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 <email protected>>
>|>|>To: Paul Dymecki <pdymecki <email protected>>
>|>|>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 <email protected>>
>|>|> > >To: Paul Dymecki <pdymecki <email protected>>
>|>|> > >CC: php-windows <email protected>
>|>|> > >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
>|>|
>|>|
>|>|--
>|>|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
>|
>|
>|

_________________________________________________________________
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