Code 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.
Code Lines (PHP)
API ID: CountLineCodePhpLanguages: Web
Targets: Architectures, Classes, Files, Project
Number of PHP lines containing source code.
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;
Of the 11 total lines, 8 contain code — every line except the two blank lines (4, 8) and the comment (2), including the opening <?php tag itself (line 1) — giving CountLineCodePhp = 8.
See Code Lines for the combined count across all languages, and Code Lines (JavaScript) for the JavaScript equivalent.
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.