scitools.com

← Metric catalog

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: CountLineCommentPhp
Languages: 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: Configuration: