NYCPHP Meetup

NYPHP.org

[nycphp-talk] Let's talk about the 'var' keyword

Chris Bielanski Cbielanski at inta.org
Fri Mar 12 10:28:22 EST 2004


Now that, good sir, is the answer I did not expect! Therefore, my query
operated perfectly!
And judging by Mintzy's response, I asked none too soon...

Thanks Dan!
~C

> -----Original Message-----
> From: Daniel Convissor [mailto:danielc at analysisandsolutions.com]
> Sent: Friday, March 12, 2004 10:18 AM
> To: NYPHP Talk
> Subject: Re: [nycphp-talk] Let's talk about the 'var' keyword
> 
> 
> On Fri, Mar 12, 2004 at 10:13:54AM -0500, Chris Bielanski wrote:
> 
> > it never occured to me before but I note that it *appears* 
> that the 'var'
> > keyword is only allowed in classes in PHP 4. AFAIK, using 
> it in a PHP4
> > function is verboten.
> 
> Correct.  It's used in Object Oriented Programming.  Var defines 
> properties' default values.  Note that they need to be 
> defined outside of 
> methods (nb: in classes, functions are called methods).   Example:
> 
> class foo {
>     var $x = 'y';
>     function bar() {
>     }
> }
> 
> var is deprecated in PHP 5, raising a new E_STRICT warning.  
> Instead of 
> using var, use public, private, protected, etc.
> 
> --Dan
> 
> -- 
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>             data intensive web and database programming
>                 http://www.AnalysisAndSolutions.com/
>  4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 



More information about the talk mailing list