You will have to post the rest of your script, or at least enough to see the creation of the object and the call to the funciton. I tried this in a test script and it works fine:
============================
<?php
class MyObj
{
var $color;
function MyObj ($incolor) {
$this->color = $incolor;
}
}
$objptr = new MyObj('green');
function testit($obj, $prop) {
return $obj->$prop;
}
print testit($objptr, 'color');
?>
==============================
So the problem does not seem to be with passing the object property name as a variable...
-- Rich Rijnders
-- Irvine, CA US