1.2.741. Multiple Unset()

Unset() accepts multiple arguments, unsetting them one after each other. It is more efficient to call unset() once, than multiple times.

<?php

// One call to unset only
unset($a, $b, $c, $d);

// Too many calls to unset
unset($a);
unset($b);
unset($c);
unset($d);

?>

See also unset.

1.2.741.1. Suggestions

  • Merge all unset into one call

1.2.741.2. Specs

Short name

Structures/MultipleUnset

Rulesets

All, Suggestions, php-cs-fixable

Exakat since

1.7.6

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Features

unset

Available in

Entreprise Edition, Exakat Cloud