Accessing class member with a parameterized name

Top Page
Author: PHP Web Development
To: PHP Web Development
Subject: Accessing class member with a parameterized name
My preferred method for getting MySQL results in PHP
is via mysql_fetch_object() rather than mysql_fetch_array().

This is because I find:


clearner than:


However, I recently find myself needing to be able to
parameterize the fieldname being accessed. So I'm
being forced to do:

$result[$fieldname] /* fieldname is assigned programatically */

Question: Is there a way to accomplish the same thing
for objects?

PHP Web Development Mailing List
php@??? (#PHP @
Searchable Archives: