ratgurrl Posted August 23, 2008 Share Posted August 23, 2008 I have what is probably a very easy question: When writing php code what special characters are acceptable and which are not. For instance, I am in the habit of using the decimal code instead of the character/symbol itself when outputting html. Example: ? for ? & for & = for = I find for XHTML strict, the decimal code is necessary for the ampersand symbol, but not for the equal and question mark. What is the best coding standard for this? I am finding differing information and samples when it comes to this. Should I always use the decimal when outputting html, or is it ok to use the question mark and equal sign to output? Jennifer Quote Link to comment Share on other sites More sharing options...
Caesar Posted August 23, 2008 Share Posted August 23, 2008 If you're asking whether or not it's fine to use the HTML equivalents of certain symbols...then your answer is yes. Your HTML should in fact be kept completely separate from your PHP so, it shouldn't even be a problem & you should stick to your strict XHTML coding practices. I encourage you to look into classes (OOP) and maybe use a templating class to load your HTML separately using methods, instead of intertwining everything into one messy 90,000 line script. Of course it's all relative. When coding a simple short PHP page, it isn't a big deal...and classes aren't really needed (Unless you go into complex functionality or whatever). Quote Link to comment Share on other sites More sharing options...
ratgurrl Posted August 23, 2008 Author Share Posted August 23, 2008 Yes, I need to learn about OOP (just bought a book) and using classes. I definitely want to expand my knowledge from the basics. For now I want to make sure I'm writing the best code I can (and as clean and neat as possible) so it's easier to migrate it later once I learn more. I appreciate your reply! Jennifer Quote Link to comment 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.