Tuesday, August 25, 2020

How and Why to Comment in Your PHP Code

How and Why to Comment in Your PHP Code A remark in PHP code is a line that isn't perused as a feature of the program. Its solitary reason for existing is to be perused by somebody who is altering the code. So why use remarks? To tell others what youre doing. On the off chance that you are working with a gathering of individuals or plan on any other person ever utilizing your content, the remarks mention to different software engineers what you were doing in each progression. This makes it a lot simpler for them to work with and to alter your code if needed.To remind yourself what you did. Despite the fact that you may simply be composing a brisk content for yourself and dont see the requirement for remarks, feel free to include them in any case. Most software engineers have encountered returning to alter their own work a year or two later and making sense of what they did. Remarks can help you to remember your considerations when you composed the code. There are a few different ways to include a remark in PHP code. The first is by utilizing/to remark out a line. This one-line remark style just remarks to the furthest limit of the line or the current code square, whichever starts things out. Here is a model: ?php reverberation hi;/this is a remark reverberation there; ? On the off chance that you have a solitary line remark, another alternative is to utilize a # sign. Here is a case of this technique: ?php reverberation hi; #this is a remark reverberation there; ? On the off chance that you have a more drawn out, multi-line remark, the most ideal approach to remark is with/* andâ */when a long remark. You can contain a few lines of remarking inside a square. Here is a model: ?php reverberation hi;/* Using this technique you can make a bigger square of text and it will all be remarked out */reverberation there; ? Dont Mix Comments In spite of the fact that you can settle remarks inside remarks in PHP, do so cautiously. Not every one of them home similarly well. PHP underpins C, C and Unix shell-style remarks. C style remarks end at the first */they experience, so dont home C style comments.â On the off chance that you are working with PHP and HTML, know that HTML remarks make no difference to the PHP parser. They wont fill in as proposed and are probably going to execute some capacity. Along these lines, remain away from:â !Remark

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.