Comment Lines (PHP) is one of the source-code metrics Understand computes across 17+ languages — browse them in the GUI, export and track them, or script them with the Python API.
Comment Lines (PHP)
API ID: CountLineCommentPhpLanguages: Web
Targets: Architectures, Classes, Files, Project
Number of PHP lines containing a comment.
For example:
<?php
// Compute a visitor count for this session
const SITE_NAME = "Understand Demo";
function nextVisit($count) {
return $count + 1;
}
$visits = 1;
$visits = nextVisit($visits);
echo "You are visitor number " . $visits . " to " . SITE_NAME;
The // Compute a visitor count for this session comment (line 2) is the only comment line, giving CountLineCommentPhp = 1.
See Comment Lines (HTML)/Comment Lines (JavaScript) for the HTML/JavaScript equivalents, and Comment Lines for the language-independent metric this breaks down.
Targets By Language:- Web: Project, File, PHP Class, PHP Interface
- This metric can be disabled from "Project Configuration/Metrics/Lines and Statements" with the "Show line count metrics" option.
- This metric can be enabled from "Project Configuration/Metrics/Lines and Statements" with the "Breakdown counts by web language" option.