Hi Guys,
I need to parse the following html data and replace the $dtphrase[] array with a different variable. How would I do that?
PHP Code:<title>$dtphrase[site_title]</title>
| SitePoint Sponsor |
Hi Guys,
I need to parse the following html data and replace the $dtphrase[] array with a different variable. How would I do that?
PHP Code:<title>$dtphrase[site_title]</title>



PHP Code:$html = '
<html>
<title>$dtphrase[site_title]</title>
</html>
';
$title = "SitePoint";
$html = preg_replace('#<title>(\$dtphrase\[site_title\])</title>#is', '<title>'.$title.'</title>', $html);
echo '<pre>'.htmlentities($html).'</pre>';
Anjanesh
Hi,
Dont think that's what im looking for...
Just want to replace the '$dtphrase[site_title]'




Use this pattern:
PHP Code:/'\$dtphrase\[site_title\]/i'
What if 'site_title' is not always the pattern?
Bookmarks