Escaping is a technique that preserves data as it enters another context. PHP is frequently used as a bridge between disparate data sources, and when you send data to a remote source, it's your responsibility to prepare it properly so that it's not misinterpreted.
Definition and Usage. The date() function formats a local date and time, and returns the formatted date string.
In practice they don't have to be escaped, except for one case: if the backslash is the last character. 'foo\\' works, but 'foo\' doesn't. I think the non-escaped backslashes should be considered as a syntactic sugar. For consistency you may want to always escape them, but it's up to you.
I'm trying to make date equal something like: Posted at 06:55 PM on 8/5/13. However I can't seem to get the "on" part work correctly. I've tried backslashing the characters I want, but everytime something like this happens: 06:55 PM o 8/5/13
I can't seem to get the "n" to show up.
This is what I have:
date("h:i A \o\n m/d/y");
According to the php manual website this should work. Help me out? Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With