Reputation: 11295
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 ?
Upvotes: 5
Views: 5317
Reputation: 4054
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.
Upvotes: 6