This question is based on my previous question. This is my code.
$this->logger->debug($datauser); // [ZN1961] => Array([#A] => 12 > 4 [#B] => 12 > 2 ), [ZN1962] => Array ([#A] => 20 > 4 [#B] => 20 > 2 )
logicexpression = ((#A) OR (#B) );
$newArr = array();
foreach ($datauser as $key => $value) {
foreach ($value as $logname => $cond) {
$this->logger->debug($cond); /// WHEN DEBEG HERE it gives correctly the $cond in each iteration
$logicexpression =str_replace($logname, $cond, $logicexpression);
}
$this->logger->debug($logicexpression ); // here I am always getting (12 > 4) OR (12 > 2)
}
`
So my problem is as I mentioned in the code I am always getting (12 > 4) OR (12 > 2).
So the output is,
@547,12 > 4
@547, 12 > 2
@557, (12 > 4) OR (12 > 2)
@547, 20 > 4
@547, 20 > 2
@557, (12 > 4) OR (12 > 2) // here it should has to come as (20 > 4) OR (20 > 2)`
Even I am getting $cond
correctly while debugging couldn't replace the relevant $cond
in iteration. I couldn't understand why ? please help me.