Hmm. It looks like it has to be a certain structure to work.
This one works as expected
<?php
$output = "<p>This paragraph is from PHP in the the snippet.</p>";
?>
<p>This paragraph is from HTML in the snippet.</p>
<?php
$output .= "<p>And this paragraph is also from the PHP in the snippet.</p>";
return $output;
?>
This one also works
<?php
$output = "<p>This paragraph is from PHP in the the snippet.</p>";
?>
<p>This paragraph is from HTML in the snippet.</p>
<?php
return $output;
?>
This structure gets converted when saved
<?php $output = "<p>This paragraph is from PHP in the the snippet.</p>"; ?>
<p>This paragraph is from HTML in the snippet.</p>
<?php return $output; ?>
Into this
<?php
$output = "<p>This paragraph is from PHP in the the snippet.</p>"; ?>
<p>This paragraph is from HTML in the snippet.</p>
<?php return $output;
?>
which echos the HTML and the last return statement, but not the $output:
This paragraph is from HTML in the snippet.
return $output;
This is the same behavior as in version 1.0.2. However, an old unused site I have on 0.9.2 does the same thing on saving, but the code works as expected.