I'm a beginner PHP coder, recently I've been told I indent my code not correctly. They say this is wrong:
if($something) {
do_something();
}
else {
something_more();
and_more();
}
While this is right?
if($something) {
do_something();
} else {
something_more();
and_more();
}
Really? I am willing to become opensource coder in nearest future so that's why I'm asking how to write code in a good way.
Both ways will run just fine. Whichever is more comfortable for you and your team would be the way to go. I personally favor the second example, or something alone these lines:
if ($something)
{
do_something();
}
else
{
do_something_else();
pet_the_ponies();
}
There's no real right answer to this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With