Skip to main content
fix code formatting
Source Link
Christos Lytras
  • 37.4k
  • 4
  • 86
  • 118

If you cannot modify the original class and extending it is not an option either, you can use the ReflectionProperty interface.

The phptoolcase library has a handy method for this:

$value = PtcHandyMan::getProperty( $your_object , ‘propertyName’'propertyName'); 

Static property from a singleton class:

$value = PtcHandyMan::getProperty( ‘myCLassName’ 'myCLassName', ‘propertyName’'propertyName'); 

You can find the tool here: http://phptoolcase.com/guides/ptc-hm-guide.html

If you cannot modify the original class and extending it is not an option either, you can use the ReflectionProperty interface.

The phptoolcase library has a handy method for this:

$value = PtcHandyMan::getProperty( $your_object , ‘propertyName’); 

Static property from a singleton class:

$value = PtcHandyMan::getProperty( ‘myCLassName’ , ‘propertyName’); 

You can find the tool here: http://phptoolcase.com/guides/ptc-hm-guide.html

If you cannot modify the original class and extending it is not an option either, you can use the ReflectionProperty interface.

The phptoolcase library has a handy method for this:

$value = PtcHandyMan::getProperty($your_object , 'propertyName'); 

Static property from a singleton class:

$value = PtcHandyMan::getProperty('myCLassName', 'propertyName'); 

You can find the tool here: http://phptoolcase.com/guides/ptc-hm-guide.html

Source Link

If you cannot modify the original class and extending it is not an option either, you can use the ReflectionProperty interface.

The phptoolcase library has a handy method for this:

$value = PtcHandyMan::getProperty( $your_object , ‘propertyName’); 

Static property from a singleton class:

$value = PtcHandyMan::getProperty( ‘myCLassName’ , ‘propertyName’); 

You can find the tool here: http://phptoolcase.com/guides/ptc-hm-guide.html