Lets talk today about comments :)
When you start coding a script then is it useful to comment your code. So a small documentation in the script. Because as long as you are working on the script and it is in a relative small size, then you know still which line of source code is doing what.
But latest when you source code is growing bigger and/or you need to work on it after a few weeks or months… then is everything gone. How was it? What is this line doing? Where do I find this and this now? Everything gone… the code is just a big pile of confusing.
Latest now you’ll kick your ass that you haven’t commented the code.
Of course it takes a bit longer if you write also comments in the code… but some when it will pay back. Also (and especially) if the code will be handed over to another programmer is it important that the code is commented.
And it is soooo simple ;) 2 slashes (//) for one line and a slash with a star for a multiple-line comment (/* at the beginning and */ at the end). And it will look like that:
<?php echo "vor dem Kommentar"; // Hier ein Einzeiliger Kommentar echo "nach dem Kommentar"; ?>
And a multiple line comment:
<?php echo "vor dem Kommentar"; /* Dieser Kommentar geht über mehrere Zeilen */ echo "nach dem Kommentar"; ?>