1.2.1094. Short Syntax For Arrays

Arrays written with the new short syntax.

PHP 5.4 introduced the new short syntax, with square brackets. The previous syntax, based on the array() keyword is still available.

<?php

// All PHP versions array
$a = array(1, 2, 3);

// PHP 5.4+ arrays
$a = [1, 2, 3];

?>

See also Array.

1.2.1094.1. Specs

Short name

Arrays/ArrayNSUsage

Rulesets

All, Appinfo, CE, Changed Behavior, CompatibilityPHP53

Exakat since

0.8.4

PHP Version

With PHP 5.3 and more recent

Severity

Critical

Time To Fix

Quick (30 mins)

Precision

Very high

Features

array

Available in

Entreprise Edition, Community Edition, Exakat Cloud