1.2.752. Native Alias Functions Usage

PHP manual recommends to avoid function aliases.

Some PHP native functions have several names, and both may be used the same way. However, one of the names is the main name, and the others are aliases. Aliases may be removed or change or dropped in the future. Even if this is not forecast, it is good practice to use the main name, instead of the aliases. Aliases are compiled in PHP, and do not provide any performances over the normal function.

Aliases are more likely to be removed later, but they have been around for a long time.

<?php

// official way to count an array
$n = count($array);

// official way to count an array
$n = sizeof($array);

?>

See also List of function aliases.

1.2.752.1. Suggestions

  • Always use PHP recommended functions

1.2.752.2. Specs

Short name

Functions/AliasesUsage

Rulesets

All, Analyze, CE, CI-checks, Changed Behavior

Exakat since

0.8.4

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Features

native

ClearPHP

no-aliases

Examples

Cleverstyle, phpMyAdmin

Available in

Entreprise Edition, Community Edition, Exakat Cloud