PHP Comments
Comments are ignored by PHP.
Used for:
- Documentation
- Notes
- Explanations
- TODOs
Single Line
// This is a comment
Alternative
# Comment
Multi Line
/*
This is
a multi line
comment
*/
Documentation Comments
/**
* Returns player money.
*/
PocketMine Example
/**
* Main plugin class.
*/
class Main {
}
TODO Comments
// TODO: Add database support.
Best Practices
✅ Explain WHY.
❌ Explain obvious things.
Bad:
// increment i
$i++;
Good:
// Increase retry count after failed login.
$retry++;