0

I have asked a question in this post

but it might look some confusing and I found no relative response, so I make it quiet simple.

The code is:

<?php
$newTitle = 'string retrieved from somewhere';
fwrite($newFile, "<title>oldTitle</title>\n");
?>

I want to replace oldTitle with $newTitle

I have tried this:

$myTitle = preg_replace('/(<title>)(.*?)(<\/title>)', $newtitle, $myTitle);

Thanks

2

1 Answer 1

4
fwrite($newFile, "<title>{$newTitle}</title>\n");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.