Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Springboard Software Blog:
Using Introspection in PHP
Jun 27, 2006 @ 16:48:01

In this new post on the Springboard Software blog today, Michael takes a look at a very handy feature that PHP has to offer those working with objects - a form of introspection.

One of the things we love about Java is its ability to use introspection. Don't know what methods or field an object has? Just ask it.

It turns out that PHP provides some nifty introspection features as well. We've found one to be particularly useful: the ability of a PHP object to tell us its member variables at runtime. Not sure what that means? Let’s look at an example.

In his example, he uses a content management system, specifically the "business objects" to illustrate his point. Introspection comes into play when the get_class_vars function is called, returning the defined variables for an object and allowing one to feed in values to be automagically set (in this case, either an array, a request, or a primary key for a record from the database).

tagged: introspection objects businessobject get_class_vars get_class introspection objects businessobject get_class_vars get_class

Link:

Springboard Software Blog:
Using Introspection in PHP
Jun 27, 2006 @ 16:48:01

In this new post on the Springboard Software blog today, Michael takes a look at a very handy feature that PHP has to offer those working with objects - a form of introspection.

One of the things we love about Java is its ability to use introspection. Don't know what methods or field an object has? Just ask it.

It turns out that PHP provides some nifty introspection features as well. We've found one to be particularly useful: the ability of a PHP object to tell us its member variables at runtime. Not sure what that means? Let’s look at an example.

In his example, he uses a content management system, specifically the "business objects" to illustrate his point. Introspection comes into play when the get_class_vars function is called, returning the defined variables for an object and allowing one to feed in values to be automagically set (in this case, either an array, a request, or a primary key for a record from the database).

tagged: introspection objects businessobject get_class_vars get_class introspection objects businessobject get_class_vars get_class

Link:

DevShed:
Abstract Classes in PHP - Introducing the Key Concepts
Jan 26, 2006 @ 12:45:35

DevShed has posted this new article today, a look at abstract classes and their development in PHP - a simple, but very useful feature that can help in a pinch.

An abstract class is a class that cannot (or should not) be instantiated. They are surprisingly useful for certain purposes. In this article, you will learn the important concepts related to abstract classes in PHP 4, and see many hands-on examples that will allow you to make use of them in your own applications.

The article looks at the creation of these classes in PHP4, then moves on to the creation of one a bit more "clever" and keeps even subclasses from instantiating it. Once that's done, they show how to use a get_class() call to pull in its functionality...

tagged: abstract classes no instantiation get_class abstract classes no instantiation get_class

Link:

DevShed:
Abstract Classes in PHP - Introducing the Key Concepts
Jan 26, 2006 @ 12:45:35

DevShed has posted this new article today, a look at abstract classes and their development in PHP - a simple, but very useful feature that can help in a pinch.

An abstract class is a class that cannot (or should not) be instantiated. They are surprisingly useful for certain purposes. In this article, you will learn the important concepts related to abstract classes in PHP 4, and see many hands-on examples that will allow you to make use of them in your own applications.

The article looks at the creation of these classes in PHP4, then moves on to the creation of one a bit more "clever" and keeps even subclasses from instantiating it. Once that's done, they show how to use a get_class() call to pull in its functionality...

tagged: abstract classes no instantiation get_class abstract classes no instantiation get_class

Link:


Trending Topics: