What is the easiest way to make this PHP function so that every other backtick becomes a beginning and ending HTML tag, so that:
'in for loops, use `$index` for 0-n values and `$count` for 1-n values'
becomes:
'in for loops, use <code>$index</code> for 0-n values and <code>$count</code> for 1-n values'
e.g.
$line = 'in for loops, use `$index` for 0-n values and `$count` for 1-n values';
echo getFormattedLine($line);
function getFormattedLine($line) {
return $line; //...str_replace, regular expressions, etc.
}
Seems pretty trivial: