<?php
echo mb_substr('123abcdef', 3);
echo "\n";
function endingCodeTag($content, $n)
{
$contentRest = mb_substr($content, $n);
preg_match('/^\<code\s+lang(?:[\s]*>|\W[^\>]*\>)/u', $contentRest, $resultArr);
if(!empty($resultArr[0]))
return $resultArr[0];
else
return '';
}
var_dump (endingCodeTag('<p> f g f rt e</p> <code lang>df g df = \(fsgfsd', 20));
var_dump (endingCodeTag('<p> f g f rt e</p> <code lang>df g df = \(fsgfsd', 18));
var_dump (endingCodeTag('<p> f g f rt e</p> <code lang>df g df = \(fsgfsd', 19));
var_dump (endingCodeTag('<p> f g f rt e</p> <code lang>df g df = \(fsgfsd', 21));
var_dump (endingCodeTag('<p> f g f rt e</p> <code lang>df g df = \(fsgfsd', 22));
var_dump (endingCodeTag('<p> f g f rt e</p> <code lang>df g df = \(fsgfsd', 23));
var_dump (endingCodeTag('<p> f g f rt e</p> <code lang>df g df = \(fsgfsd', 24));