Jump to content

last time i checked those were guidelines for a CMS and framework, neither of which I use. Also who said I want to get a job coding? I do it for fun.

 

The last one (PSR-1) is a PHP standard developed by the PHP Framework Interoperability Group. This is the base standard for many open-source projects and frameworks in PHP.

 

You may do it for fun and not care about learning how to code correctly but many people asking questions are here to learn.

 

It's better for those people to learn about these standards and be aware of them rather than ignoring them, picking up bad coding habits and then finding it harder when doing it in a job if they go that way.

Link to comment
https://linustechtips.com/topic/308569-php-debate/page/2/#findComment-4214214
Share on other sites

Link to post
Share on other sites

The last one (PSR-1) is a PHP standard developed by the PHP Framework Interoperability Group. This is the base standard for many open-source projects and frameworks in PHP.

 

You may do it for fun and not care about learning how to code correctly but many people asking questions are here to learn.

 

It's better for those people to learn about these standards and be aware of them rather than ignoring them, picking up bad coding habits and then finding it harder when doing it in a job if they go that way.

Obviously you have no experience developing with php, using short tags in any of the previous scenarios wouldn't change anything unless you're running an older version of php and don't have short tags enabled in your php.ini Also, just because someone says it's not proper unless you add "php" in the tags doesn't mean anything.

i want to die

Link to comment
https://linustechtips.com/topic/308569-php-debate/page/2/#findComment-4214508
Share on other sites

Link to post
Share on other sites

Obviously you have no experience developing with php, using short tags in any of the previous scenarios wouldn't change anything unless you're running an older version of php and don't have short tags enabled in your php.ini Also, just because someone says it's not proper unless you add "php" in the tags doesn't mean anything.

 

I actually have a lot of experience from working for a global company developing business solution products using Zend Framework and Wordpress in PHP. What I'm trying to say is most companies don't run the latest and greatest software, they stick with what works and configuring it to allow useless features across 3 data centres worth of live servers and hundreds of development servers isn't going to happen.

 

Plus as I have repeated many times, if you use any system that defines standards and ignore them your code will fail in testing. Not because it won't work but because when you are working in a team code that sticks to defined standards is easier for everyone to read and understand.

 

When we commit code it is picked up by our CI servers, PHPUnit tests are run, Selenium tests are run and standards compliance tests are run. If any of it fails your code is going nowhere near the main code base or live servers.

 

If people are here to learn they should learn about standards as well, yes you can ignore them but you shouldn't and in a real work environment you will have to follow them.

Link to comment
https://linustechtips.com/topic/308569-php-debate/page/2/#findComment-4216942
Share on other sites

Link to post
Share on other sites

I actually have a lot of experience from working for a global company developing business solution products using Zend Framework and Wordpress in PHP. What I'm trying to say is most companies don't run the latest and greatest software, they stick with what works and configuring it to allow useless features across 3 data centres worth of live servers and hundreds of development servers isn't going to happen.

 

Plus as I have repeated many times, if you use any system that defines standards and ignore them your code will fail in testing. Not because it won't work but because when you are working in a team code that sticks to defined standards is easier for everyone to read and understand.

 

When we commit code it is picked up by our CI servers, PHPUnit tests are run, Selenium tests are run and standards compliance tests are run. If any of it fails your code is going nowhere near the main code base or live servers.

 

If people are here to learn they should learn about standards as well, yes you can ignore them but you shouldn't and in a real work environment you will have to follow them.

I can understand that, but using <? instead of <?php you'll know immediately if it does create problems plus, control + h > replace all <? with <?php if it does. Also respect you for not getting angry.

i want to die

Link to comment
https://linustechtips.com/topic/308569-php-debate/page/2/#findComment-4219247
Share on other sites

Link to post
Share on other sites

Why argue about syntax?

Look if you can see that it is a for loop and see what happens then it's good formatting. Programming is like fashion, wear your personality not someone else's.

 

People need to not worry about the representation of code and look at the meanings and thought behind it, the programming rather than the coding. People make programming out to be something that robots do, just repeating things and giving other things instructions how you were told to do that. Real programming is when you take your passion and your thought process and make that into something that everyone else can enjoy and benefit from. These are the people who revolutionise our world.

 

Think about it at a low level, not what it looks like on the higher level.

Link to comment
https://linustechtips.com/topic/308569-php-debate/page/2/#findComment-4231609
Share on other sites

Link to post
Share on other sites

The key is consistency. Do it the way you want, as long as you do it everywhere the same way (project scope). There are so many formatters and prettifiers out there, it really doesn't matter. I'm just using a slightly modified PHPStorm default.

Link to comment
https://linustechtips.com/topic/308569-php-debate/page/2/#findComment-4241162
Share on other sites

Link to post
Share on other sites

 

First one.

$Agree = "false";$Sad = "false";If ($Agree == "true"){   LikeMyComment();}else{   $Sad = "true";}

 

Yeah that is this same but as i put i like to nest the else next to the if },

 

I once had a debate about the use of case in variables houseNumber or HouseNumber. I use the first as i find that easier to read. each to their own.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
https://linustechtips.com/topic/308569-php-debate/page/2/#findComment-4278371
Share on other sites

Link to post
Share on other sites

Yeah that is this same but as i put i like to nest the else next to the if },

 

I once had a debate about the use of case in variables houseNumber or HouseNumber. I use the first as i find that easier to read. each to their own.

Hmm, everyone has his/her own personal preferences.

I like HouseNumber more, because if used in a note or in an if statement, it's easier to see.

 

 

By the way, I completely forget how2PHP so didn't know you had to use $ every time you use a variable :P

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
https://linustechtips.com/topic/308569-php-debate/page/2/#findComment-4278395
Share on other sites

Link to post
Share on other sites

Hmm, everyone has his/her own personal preferences.

I like HouseNumber more, because if used in a note or in an if statement, it's easier to see.

 

 

By the way, I completely forget how2PHP so didn't know you had to use $ every time you use a variable :P

I think it is java that the "standard" is lowercase for names of classes and such and I just got into the habit of doing that.

 

single word variables i write as $number so to keep it all looking the same i cap second + words

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
https://linustechtips.com/topic/308569-php-debate/page/2/#findComment-4278426
Share on other sites

Link to post
Share on other sites

I think it is java that the "standard" is lowercase for names of classes and such and I just got into the habit of doing that.

 

single word variables i write as $number so to keep it all looking the same i cap second + words

well, you should always say what the variable being initialized if for so it is always clear.

And you should always put in the notes what a fucntion or whatever is for, so yeah..

I write single words without capitals most of the time.

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
https://linustechtips.com/topic/308569-php-debate/page/2/#findComment-4278446
Share on other sites

Link to post
Share on other sites

well, you should always say what the variable being initialized if for so it is always clear.

And you should always put in the notes what a fucntion or whatever is for, so yeah..

I write single words without capitals most of the time.

First rule of coding //comments 

Second clear spacing

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
https://linustechtips.com/topic/308569-php-debate/page/2/#findComment-4278459
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×