function conditionEvaluator($condition) { //Sirve para evaluar las condiciones generadas recursivamente $aux = ''; foreach ($condition as $key => $value) { //si el operador logico no es nulo, es porque hay un valor anterior, tomo ese valor + el op logico y el valor actual y uso stringEvaluator if (!is_null($value['oper'])) { $aux = stringEvaluator($aux, intval($value['cond']), $value['oper']) == 1 ? 1 : 0; } else { $aux = intval($value['cond']); } } return $aux; }
/** * conditionEvaluator - used to evaluate recursive conditionals * * @access public * @since 1.0 * @param string $condition * @return int(boolean) */ function conditionEvaluator($condition) { $aux = ''; foreach ($condition as $key => $value) { //if operator is null means that exist a prev value, //take the + and the logic operator and the current value //and use stringEvaluator if (!is_null($value['oper'])) { $aux = stringEvaluator($aux, intval($value['cond']), $value['oper']) == 1 ? 1 : 0; } else { $aux = intval($value['cond']); } } return $aux; }