Esempio n. 1
0
function filterEquationBrackets($q)
{
    $serializedEquation = serializeEquationToArray($q);
    $equation = deserializeArrayToEquation($serializedEquation);
    $filteredSerializedEquation = filterBracketBySerializedEquation($serializedEquation);
    return deserializeArrayToEquation($filteredSerializedEquation);
}
Esempio n. 2
0
function deserializeArrayToEquation($serializedEquation)
{
    // init
    $equation = '';
    // process
    foreach ($serializedEquation as $c) {
        // recursive to get characters if $c is array
        if (is_array($c)) {
            $equation .= deserializeArrayToEquation($c);
            continue;
        }
        // get character
        $equation .= $c;
    }
    return $equation;
}