If a multi-line string is inside an if or switch statement, the code block only gets collapsed till the start of the multi-line string, for example: // if or switch here... $str = <<<STRING code .... STRING;