I’m getting this cryptic nbotice on the following line of code:
$this->$aStyles = $aStyles;
this line of code lives in this function:
private function cleanStyles()
{
if ((isset($this->sValue))&&($this->sValue))
{
$this->aStyles = array();
return true;
}
$aStyles = array();
foreach ($this->aStyles as $oStyle)
if ($oStyle->cleanStyles())
$aStyles[] = $oStyle;
$this->$aStyles = $aStyles;
return (count($this->$aStyles)>0);
}
Any idea about why this notice would show up?
Here’s a bit of background about what I am trying to do in case it helps:
I have an object hierarchy that represents an excel report. The hierarchy talks to phpExcel to actually draw the report. One of the steps that the hierarchy takes when preparing to be drawn is cleaning up the styles arrays.
Style objects can contain arrays of style objects or can contain a value.
cleanStyles is supposed to recursively clean up styles so they can be converted into valid phpExcel style arrays by making sure all styles that exist either have a value or an array of valid styles.
Remove the
$sign from your property dereference:Your code didn’t work because php is trying to evaluate
$aStylesbefore trying to access the object value. In this case aStyles is an array thus you get the notice because that syntax is only valid ifaStylesis a String