Nowadays i'm trying to develop a php framework for own customers. In my app, I want to pass $instance->propertyName
as parameter. But don't need $instance->propertyName
value. Only I want to use propertyName part as string value. Can I take propertyName as string?
For example if I have an object $bar
of the class
class foo
{
public $someProperty1;
public $someProperty2;
}
$bar = new foo();
and if I have another class like
class anotherClass
{
public function someMethod($arg)
{
//I need the property name that provide the $arg value in this place
}
}
and when I run this code
$someObject = new anotherClass();
$someObject->someMethod($bar->someProperty1); //I want to know the name of property that provide a value to the someMethod method (the 'someProperty1' in this case)
then I want to know inside the method someMethod
in anotherClass
class the name of the property that provide the $arg
value. As the result for example above I want to get a string someProperty1
.