End of comments

A function in PHP may look like the following:

function calculate($total, $sex) { if ($total== 23) { if ($sex == 'female') { /* do some * stuff * * * finishing } //end if sex } //end if total } //end calculate

Line that has start and finish written at opposite sidesAt the end of the conditional and function we have comment strings stating what is ending. This can be useful if we have multiple conditionals within each other and also when the end of the conditionals are many lines below their beginning, thus making our code a little easier to read. But the very fact of doing this usually indicates improper algorithmic construction.

What we should always try to achieve are very small functions that do small tasks. We rarely will need to comment closing constructs and you should try to avoid them as much as possible. If you think you need them, then think about the construction of your algorithm and maybe think about splitting it up.

Our recommendation is to avoid using comments to let the user know something is ending. In the end it is evidence your code is hard to read and another problem exists.