PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
However I want to add apostrophies in the word "Valentines" so it is gramatically correct. When I do an error is detected as the parser thinks it has reached the end of the line. Is it possible?
Nope, read the manual on echo. Comma performs faster but generally isn't recommended because it isn't polymorphic with string assignments. I use comma when I know the code will only be used for output and will definitely never be stored.
I just think it's more dense and less distracting than (raw)?url(en|de)code - Also you don't need to worry about ampersands messing up your url parsing.
The downside of base64* is that it's non-human-readable, but if I'm using a request to pass any amount of data to the server I'll typically just POST it.
urlencode is great for making 'tokens' - like url friendly article names, but even then I'm inclined to just remove the offending characters altogether (with a few custom substitutions): http://domain.com/holidays/valentines_day instead of: http://domain.com/holidays/Valentine%27s%20Day
But no token should ever need to be decoded, so it's not really an encoding so much as a 'leg up' on a transformation.
My rule is basically this: when passing things like select options, I base64_encode them and call it a day. Do the urlencode functions handle things like newlines? I've just never tried...
man page wrote:Apache's mod_rewrite and mod_proxy are unable to handle urlencoded URLs properly - http://issues.apache.org/bugzilla/show_bug.cgi?id=34602
If you need to use any of these modules and handle paths that contain %2F or %3A (and few other encoded special url characters), you'll have use a different encoding scheme.
man page wrote:In JavaScript when you try to encode utf-8 data with escape function you will get some strange encoded string which you wont be able to decode with php url(de)encode funtions.
man page wrote:Not all browsers perform the same encodeing.
man page wrote:microsoft uses an different table for encode string when sending data...
base64_(en|de)code doesn't seem to suffer from nearly as many caveats, and the only thing you lose is URL readability, which (IMO) you shouldn't be using it for anyway. Thus, I save my Advil money and debugging time and treat myself to an overpriced coffee once in a while