Tool for porting alternative PHP tags to <?php, <?= and ?>

September 12, 2014 · View on GitHub

&$token) { if ($token[0] === T_OPEN_TAG) { if (strpos($token[1], '') === 0) {
            continue;
        }

        if (preg_match('~^(?:%>|</script\s*>)(\s*)$~', $token[1], $matches)) {
            $token[1] = '?>' . $matches[1];
        }
    }
}

return $tokens;

}

function tokensToCode(array tokens) { code = ''; foreach (tokensastokens as token) { if (is_array(token)) { code .= token[1]; } else { code .= token; } } return code; }