proggR Posted August 15, 2011 Share Posted August 15, 2011 I started working at a job a couple months ago and the boss really stresses "proper" spacing. I do it because I have to and its not really that different from how I normally code but it is strange to get used to. I was wondering how everyone else spaces their code. How I normally space my code: if(condition){ //code } How I space my code at work: if (condition) { //code } As I said, its not that different but getting used to those extra spaces is actually harder than I thought it would be. I'd be interested in seeing what other people use. Quote Link to comment https://forums.phpfreaks.com/topic/244853-spacing-style/ Share on other sites More sharing options...
AyKay47 Posted August 15, 2011 Share Posted August 15, 2011 i write an if condition how you normally would.. Quote Link to comment https://forums.phpfreaks.com/topic/244853-spacing-style/#findComment-1257805 Share on other sites More sharing options...
Maq Posted August 15, 2011 Share Posted August 15, 2011 I started working at a job a couple months ago and the boss really stresses "proper" spacing. They were probably saying that because both the PHP manual and the Zend Framework use the same exact style for IF blocks, but are different when it comes to class constructors and methods. Quote Link to comment https://forums.phpfreaks.com/topic/244853-spacing-style/#findComment-1257829 Share on other sites More sharing options...
Philip Posted August 15, 2011 Share Posted August 15, 2011 It depends on the project. My typical when doing a quick script that isn't attached to a project: if($condition == value) { return $x; } Quote Link to comment https://forums.phpfreaks.com/topic/244853-spacing-style/#findComment-1257878 Share on other sites More sharing options...
cs.punk Posted August 17, 2011 Share Posted August 17, 2011 It's hardly noticable..? Quote Link to comment https://forums.phpfreaks.com/topic/244853-spacing-style/#findComment-1258550 Share on other sites More sharing options...
Maq Posted August 17, 2011 Share Posted August 17, 2011 Also, you may already know this, but you can import an XML sheet to auto-format/space your code. I know for Eclipse you just hotkey ctr+shft+F. Quote Link to comment https://forums.phpfreaks.com/topic/244853-spacing-style/#findComment-1258598 Share on other sites More sharing options...
proggR Posted August 17, 2011 Author Share Posted August 17, 2011 I really shut setup my environment to format the way I'm asked. It would make things a lot easier. I've had it autoformat a file once but it wasn't setup the same way so I stopped using it. I used to use it before every save when I worked with Java in Eclipse/RAD. There were no formatting guidelines to follow there though. Quote Link to comment https://forums.phpfreaks.com/topic/244853-spacing-style/#findComment-1258715 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.