I have fought with this for multiple days now. Im trying to get my preg_replaces working.
I'm getting the data to use the preg-replace
on from a database and binding them to variables. $post_preview
is one of them.
<?php
$body_sub = substr($post_preview, 0) . "<br><br><a href='post.php?id=$post_id'> Continue Reading →</a>";
echo nl2br($body_sub); ?></p>
<?php
//bold
$post_preview = preg_replace('/(\[bold\])/', '<strong>', $post_preview);
$post_preview = preg_replace('/(\[\/bold\])/', '</strong>', $post_preview);
echo '[bold]Test[/bold]';
//italic
$post_preview = preg_replace('/(\[i\])/', '<i>', $post_preview);
$post_preview = preg_replace('/(\[\/i\])/', '</i>', $post_preview);
This isn't replacing the [i]
and [bold]
nor the [/i]
and the [/bold]
. No errors even with E_ALL
. What have I done wrong and how do I fix it?