When something isn't working, make sure to check the source code for error, don't just look browser's rendering. In the source, you'd clearly have seen that <?phpecho$hi;?>
wasn't evaluated, but instead just printed in the source.
So in conclusion, <?phpecho$hi;?>
is wrong. Write <?php echo $hi;?>
.