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.
Lines (PHP)
API ID: CountLinePhpLanguages: Web
Targets: Architectures, Classes, Files, Project
Number of all PHP lines.
Every line of a .php file counts here, from the opening <?php tag onward. Unlike an HTML file's embedded <script> block (see Lines (JavaScript)), markup mixed into a PHP file isn't broken out into a separate HTML or JavaScript count — it's all PHP.
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;
sample.php is 11 lines total, all of which count as PHP (including the opening <?php tag on line 1), giving CountLinePhp = 11.
See Blank Lines (PHP) and Comment Lines (PHP) for the PHP breakdown, and Lines (HTML)/Lines (JavaScript) for the equivalents on an HTML file with an embedded script. See Lines for the language-independent total across the whole file.
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.