dtyson2000 Posted July 3, 2008 Share Posted July 3, 2008 Hi everybody... I've recently decided to clean up the mess that is my php coding. It's all over the place and I can't keep doing it this way. Does anybody have a reference they would like to share for proper php markup, spacing, etc.? I search around but find bits and pieces of things on various sites. I would really appreciate it. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/113009-proper-markup-reference/ Share on other sites More sharing options...
vbnullchar Posted July 3, 2008 Share Posted July 3, 2008 do some indentions for better readability Quote Link to comment https://forums.phpfreaks.com/topic/113009-proper-markup-reference/#findComment-580510 Share on other sites More sharing options...
dtyson2000 Posted July 3, 2008 Author Share Posted July 3, 2008 Yes. I do indentations but I find that they're, at times, not constant. I just wondered if there was a sort of "standard" or conventional way for writing the code that I could pick up. Thanks for the suggestion. Quote Link to comment https://forums.phpfreaks.com/topic/113009-proper-markup-reference/#findComment-580550 Share on other sites More sharing options...
trq Posted July 3, 2008 Share Posted July 3, 2008 Consistency is the key, pick a method you like and stick to it. Having said that, most frameworks usually have some form of 'coding standard' detailed in there documentation somewhere, maybe take a look at one of them? Really though, its personal preference and as long as your consistent, it should remain easy enough to follow. Quote Link to comment https://forums.phpfreaks.com/topic/113009-proper-markup-reference/#findComment-580574 Share on other sites More sharing options...
Daniel0 Posted July 3, 2008 Share Posted July 3, 2008 Not necessarily thorpe. I remember a person from here that used to consistently write code without any white-space whatsoever. That wasn't readable nor easy to follow Generally, it's pretty standard to go one indention level in at an opening curly bracket and go one indention level out when you close it again. Also, some people like the opening bracket on the same line as the preceding statement, some like it on a line below by itself. Some people use a space between a function call or a keyword and a succeeding parenthesized statement or argument list. Some people add spacing after commas like one would do in a natural language (e.g. English) for things that are separated by commas. Some people add spacing around the concatenation operator (dot (.)). Some people like to use a fixed amount of spaces instead of the tab character (usually four). There are many ways, but there is no best way (although there are some ways I would say look horrible and are difficult to follow). Quote Link to comment https://forums.phpfreaks.com/topic/113009-proper-markup-reference/#findComment-580628 Share on other sites More sharing options...
.josh Posted July 3, 2008 Share Posted July 3, 2008 de ja vu Quote Link to comment https://forums.phpfreaks.com/topic/113009-proper-markup-reference/#findComment-580630 Share on other sites More sharing options...
trq Posted July 3, 2008 Share Posted July 3, 2008 Not necessarily thorpe. I remember a person from here that used to consistently write code without any white-space whatsoever. That wasn't readable nor easy to follow Agreed. I guess I never thought anyone would actually be that ridiculous consistently. Quote Link to comment https://forums.phpfreaks.com/topic/113009-proper-markup-reference/#findComment-580751 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.