Re: [PHP] PHP5 object construct

This is a discussion on Re: [PHP] PHP5 object construct within the PHP General forums, part of the PHP Programming Forums category; >> I read about a feature of PHP5 OOP that is something like this in a book >> ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-23-2006
Chris Boget
 
Posts: n/a
Default Re: [PHP] PHP5 object construct

>> I read about a feature of PHP5 OOP that is something like this in a book
>> or
>> a magazine a while back. But now I don't remember exactly how this works
>> and I can't find any reference to it in the online docs. The basic idea
>> is
>> something along these lines:
>>
>> class MyClass {
>>
>> private $bob;
>> public $Bob {
>> set( $var ) {
>> $this->bob = $var;
>>
>> }
>> get() {
>> return $this->bob;
>>
>> }
>> }
>> }
>>
>> Could someone point me to the relevant section of the docs that discusses
>> this?


> http://us2.php.net/class


Any particular place on that page I should be looking? I've read it several
times and didn't see anything like the above. The closest thing I saw were
actual methods called setBob() and getBob(), which isn't exactly what I'm
looking for...

thnx,
Chris
Reply With Quote
  #2 (permalink)  
Old 09-23-2006
Joe Wollard
 
Posts: n/a
Default Re: Re: [PHP] PHP5 object construct

well, perhaps I'm not seeing what it is that you're looking for. The
page I sent you is a basic introduction to classes and OOP in PHP,
which based on the example that you've provided seemed like what you
wanted. It seems obvious that you want to learn more about OOP, but
are you trying to find a specific 'bob' example or would you just like
some help understanding OOP? What is the end result you're hoping to
get out of the list?.....Google also provided these results, which
might help you if a specific example is what you're looking for:
http://pear.php.net/reference/PhpDoc...howto.pkg.html
http://us3.php.net/get_object_vars
http://us3.php.net/spl

Feel free to help us help you ;-)


On 9/22/06, Chris Boget <chris.boget@wild.net> wrote:
> >> I read about a feature of PHP5 OOP that is something like this in a book
> >> or
> >> a magazine a while back. But now I don't remember exactly how this works
> >> and I can't find any reference to it in the online docs. The basic idea
> >> is
> >> something along these lines:
> >>
> >> class MyClass {
> >>
> >> private $bob;
> >> public $Bob {
> >> set( $var ) {
> >> $this->bob = $var;
> >>
> >> }
> >> get() {
> >> return $this->bob;
> >>
> >> }
> >> }
> >> }
> >>
> >> Could someone point me to the relevant section of the docs that discusses
> >> this?

>
> > http://us2.php.net/class

>
> Any particular place on that page I should be looking? I've read it several
> times and didn't see anything like the above. The closest thing I saw were
> actual methods called setBob() and getBob(), which isn't exactly what I'm
> looking for...
>
> thnx,
> Chris
>
>
>

Reply With Quote
  #3 (permalink)  
Old 09-23-2006
Martin Marques
 
Posts: n/a
Default Re: [PHP] PHP5 object construct


On Fri, 22 Sep 2006 20:15:49 -0400, "Chris Boget" <chris.boget@wild.net> wrote:
>> http://us2.php.net/class

>
> Any particular place on that page I should be looking? I've read it
> several
> times and didn't see anything like the above. The closest thing I saw
> were
> actual methods called setBob() and getBob(), which isn't exactly what I'm
> looking for...


Check here:

http://us2.php.net/manual/en/language.oop5.magic.php

--
---------------------------------------------------------
Lic. MartÃ*n Marqués | SELECT 'mmarques' ||
Centro de Telemática | '@' || 'unl.edu.ar';
Universidad Nacional | DBA, Programador,
del Litoral | Administrador
---------------------------------------------------------
Reply With Quote
  #4 (permalink)  
Old 09-23-2006
Chris Boget
 
Posts: n/a
Default Re: [PHP] PHP5 object construct

>> Any particular place on that page I should be looking? I've read it
>> several
>> times and didn't see anything like the above. The closest thing I saw
>> were
>> actual methods called setBob() and getBob(), which isn't exactly what I'm
>> looking for...

> Check here:
> http://us2.php.net/manual/en/language.oop5.magic.php


So the only way I can do anything like this is by implementing the __get()
and __set() methods? There is no attribute/property construct that is
similar to the sample code in my OP?

thnx,
Chris
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:15 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0