soycharliente Posted March 13, 2008 Share Posted March 13, 2008 Fresh pair of eyes? Is there an easier way? This is the line: <?php $thedate = date("m\<\b\r \/\>d\<\b\r \/\>y", strtotime($row["post_date"])); echo "<div class=\"blog-post-date\">{$thedate}</div>"; ?> This is output: <div class="blog-post-date">03<b />12<b />08</div> This is desired: <div class="blog-post-date">03<br />12<br />08</div> Quote Link to comment https://forums.phpfreaks.com/topic/96024-solved-esacping-text-inside-date/ Share on other sites More sharing options...
lemmin Posted March 13, 2008 Share Posted March 13, 2008 This should work: <?php $thedate = date("m<b\\r />d<b\\r />y", strtotime($row["post_date"])); ?> Quote Link to comment https://forums.phpfreaks.com/topic/96024-solved-esacping-text-inside-date/#findComment-491594 Share on other sites More sharing options...
paul2463 Posted March 13, 2008 Share Posted March 13, 2008 try this $thedate = date("m<b\\r />d<b\\r />y", strtotime($row["post_date"])); Quote Link to comment https://forums.phpfreaks.com/topic/96024-solved-esacping-text-inside-date/#findComment-491595 Share on other sites More sharing options...
soycharliente Posted March 13, 2008 Author Share Posted March 13, 2008 This should work: <?php $thedate = date("m<b\\r />d<b\\r />y", strtotime($row["post_date"])); ?> It does. Why aren't you escaping the entire <br /> tag? And the double slash to escape the escaping of the r to prevent new line? Quote Link to comment https://forums.phpfreaks.com/topic/96024-solved-esacping-text-inside-date/#findComment-491596 Share on other sites More sharing options...
paul2463 Posted March 13, 2008 Share Posted March 13, 2008 the out put is a text string so you dont need to escape out all of the text , just the bits that seem like code which "\r" is so you escape out the first "\" and it prints out the full tag as it should Quote Link to comment https://forums.phpfreaks.com/topic/96024-solved-esacping-text-inside-date/#findComment-491599 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.