Sounds like your just trying to do something like this:
- $html = '<center>' . $someText . '</center>';
Which you can also write as:
- $html = "<center>$someText</center>";
-
-
// Or like this:
-
$html = sprintf('<center>%s</center>', $someText);
-
-
// Or:
-
$html = str_replace('<center>SOME_TEXT</center>', 'SOME_TEXT', $someText);
P.S.
The
<center>
tags are antiquated and really shouldn't be used. Instead, use CSS with normal structure tags, like
<div>
or
<span>
- For example, if all you wanted was a line of text centered on the screen, the "best practice" would be to do something like:
-
<!DOCTYPE html>
-
<html>
-
<head>
-
<style type="text/css">
-
#myTextDiv {
-
text-align: center;
-
}
-
</style>
-
</head>
-
<body>
-
<div id="myTextDiv">Insert text here</div>
-
</body>
-
</html>
-
And then you'd move the style into an external document later on, but this is a good start.
If you're having a hard time following the syntax of that example, I suggest you take some time to study CSS. It's a required skill if you plan on doing web-development these days.