$str='<html>...<header>...</header>...</html>';
//$str='<HTML>...<HEADER>...</HEADER>...</HTML>';
$header = explode("<header>", $str, 2);
echo $header[1];
I have many html code, I want explode header tag, but some uppercase and some are lowercase, cause the $str is very huge, I do not want use str_replace() change them all to uppercase or lowercase, is there any easy way to explode header tag for 2 part from a $str? Thanks.
There is a way – preg_split() function!
Didn’t test the regex, but i think this is what you’re looking for: