Okay, that worked, but introduced another issue.
This is specifically a problem with alternate syntax (vs. using curly brackets). It does not occur when using curly brackets. This problem seems restricted specifically to the foreach statement, I've tried for, while, do, switch and so on and all of those work as expected.
Given the following as the first foreach statement in the PHP script:
foreach( $item as $key ):
----endforeach
When I add the semicolon it formats properly:
foreach( $item as $key ):
endforeach;`
With every new foreach statement in the script, though, the moment I add the semicolon, the first line of the statement jumps up and appends itself to the end of the line after the last semicolon, as such:
Expected:
foreach ( $item as $key ):
endforeach;
$b = 2;
foreach ( $test as $error ):
endforeach;
What occurs:
endforeach;
$b = 2; foreach ( $test as $error ):
endforeach;
This occurs no matter what the previous line contains or does, if there is a semicolon there, adding the semicolon to the endforeach to close the statement causes the formatting issue.
This also occurs if I am pasting a foreach block into a function or page, as soon as I paste the block, the first line jumps to the end of the last line with a semicolon.
Any thoughts?