Main Contents

Articles

Proper commenting in PHP

PHP, Tumblr December 21, 2010

Do NOT comment in PHP with a // double slash if you are using the closing tag on the same line, instead use the /**/ type of commenting. I am amazed of how many people do that, forgetting that anything after the // will be considered part of the comment and thus nullifying the closing PHP bracket.

<?php // this is wrong ?>
<?php /* this will work properly */ ?>

 

Leave a comment


Google Analytics Alternative