You are here: Re: Is there a generic Object in PHP? « PHP Programming Language « IT news, forums, messages
Re: Is there a generic Object in PHP?

Posted by Rik Wasmus on 10/01/65 12:00

On Wed, 16 Jan 2008 14:56:44 +0100, Rob <ratkinson@tbs-ltd.co.uk> wrote:

> On Jan 16, 10:11 am, micah <micahk...@gmail.com> wrote:
>> try using this a generic object:
>>
>> $obj = new stdClass();
>>
>> On Jan 15, 6:14 pm, KDawg44 <KDaw...@gmail.com> wrote:
>>
>>
>>
>> > Hi,
>>
>> > I would like to have a function that takes a generic object and takes
>> > some action on this.   Something like,
>>
>> > function AMethod(Object obj) {
>> >          DoSomeStufftotheObject;
>>
>> > }
>>
>> > then be able to pass various object types in.  Is there a way to do
>> > this in PHP?  Do classes automatically inherit from a generic Object
>> > like in Java?
>>
>> > Thanks.- Hide quoted text -
>>
>> - Show quoted text -
>
> Just out of interest, is there any way to see what properties,
> methods, constructs, etc the generic stdClass object has? Or maybe
> it's documented somewhere?

Reflection could tell you, but the answer is much quicker: is has none (no
methods, no properties). This also is NOT the 'main class/object' from
which all other classes/objects are derived. It's just an empty container.
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация