You are here: Re: Test for the existence of a null property « PHP Programming Language « IT news, forums, messages
Re: Test for the existence of a null property

Posted by Marcin Dobrucki on 08/08/06 13:47

wildernesscat wrote:
> Hi Jerry,
>
> I'm trying to write a function that checks whether a given object is of
> a known class (named 'A' in this example). I want it to work even if
> the object has been constructed manually, starting from 'new
> StdClass()'.

I think this is VERY different from what you asked in the first mail.
But to do that, you want something like this:

class Foo (
function Foo() {}
}

$f = new Foo();
....
if (is_a($f, 'Foo')) {
echo "yes";
}
....
echo "\$f is of type: " . get_class($f);

To do what you asked before (and hence break some main concepts in
OO), you can:

$vars = get_class_vars('Foo');

/M

 

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

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