Hi John

I knew __get and __set available, but i want to told C# like syntax is a
nice and clear syntax if available in php5 ,
so we dont need to check property name and then set value .





"John Lim" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi Masoud,
>
> It's already available. See
>
> http://www.phppatterns.com/index.php/article/articleview/28/1/2/
>
> "Masoud" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > It's just a suggestion to have a syntax like this in PHP5!
> >
> > A property is similar to a field (a member variable), with the exception
> > that there is a getter and a setter
> > method, as follows :
> >
> > public class Car
> > {
> >     private string make;
> >     public string Make
> >     {
> >         get { return make; }
> >         set { make = value; }
> >      }
> > }
> >
> > Car c = new Car( );
> > c.Make = "Acura"; // use setter
> > String s = c.Make; // use getter
> >
> > above example is a simple C# example in NET Framework Essentials.
> >
> >
> > Masoud
> >
> >
>
>



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to