Accessing class member with a parameterized name

Top Page
Author: PHP Web Development
Date:  
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:

$result_object->fieldname

clearner than:

$result_object['fieldname']

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 @ irc.free.net.ph)
http://lists.free.net.ph/mailman/listinfo/php
Searchable Archives: http://archives.free.net.ph