It’s easier just to give a code sample:
private $ParseRuleMap = array();
public function __construct( $rules ) {
foreach( $rules as $which=>$rule ) {
$mapping = $rule->getMinimumMatchables();
foreach( $mapping as $match ) {
$rulelvl &= $this->ParseRuleMap; // Fun begins here
$len = strlen($match);
for( $i=0; $i<$len; $i++ ) {
if( !isset($rulelvl[ $match[$i] ]) ) {
$rulelvl[ $match[$i] ] = array();
}
$rulelvl &= $rulelvl[ $match[$i] ]; // Here too!
}
// ... other code here ...
}
}
}
I get the following error spamming frequently (for the above commented lines):
PHP Warning: Cannot use a scalar value as an array in parser.php on line 35
Am I misunderstanding how reference assignment works here? To (try) to be clear, $rulelvl is supposed to iterate down through a given line of $this->ParseRuleMap‘s sub-arrays via. reference-assignment.
&=is abitwise operator(bitwise “and” and assign) not thereference operatorChange your code as this: