Example no 1:
$something = [1,2,3,4]
foreach ($something as $key => $value) {
//code code code
}
$something2 = [];
I can't find clear answer about new live before and after foreach, what PSR-2 say about that ?
Deprecated - As of 2019-08-10 PSR-2 has been marked as deprecated.
PSR-12 seeks to provide a set way that both coding style tools can implement, projects can declare adherence to and developers can easily relate on between different projects for these coding style reducing cognitive friction.
The PHP Standard Recommendation (PSR) is a PHP specification published by the PHP Framework Interoperability Group (PHP-FIG). It serves the standardization of programming concepts in PHP. The aim is to enable interoperability of components.
Also known as “Critical Point” and “Point of No Return”, these two formulas should be considered when planning a flight and can help making decisions in an emergency. PSR is the point furthest from the airfield of departure that an aircraft can fly and still return to base within its safe endurance. (
Point 2.3 "Lines" Make it optional to add blank lines before and after statements. It is still useful to separate code blocks in "paragraphs" to improve logic comprehension and readability.
Blank lines MAY be added to improve readability and to indicate related blocks of code.
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