PHPackages                             phpbsb/php-short-array-syntax-converter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. phpbsb/php-short-array-syntax-converter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

phpbsb/php-short-array-syntax-converter
=======================================

Command-line script to convert or revert PHP's array() syntax to PHP 5.4's short array syntax \[\] using PHP's built-in tokenizer.

214PHP

Since Apr 6Pushed 10y ago3 watchersCompare

[ Source](https://github.com/phpbsb/php-short-array-syntax-converter)[ Packagist](https://packagist.org/packages/phpbsb/php-short-array-syntax-converter)[ RSS](/packages/phpbsb-php-short-array-syntax-converter/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP 5.4 Short Array Syntax Converter
====================================

[](#php-54-short-array-syntax-converter)

Command-line script to convert and revert PHP's `array()` syntax to PHP 5.4's short array syntax`[]` using PHP's built-in tokenizer.

By relying on the PHP tokenizer, nothing but the array syntax itself will be altered. The script was successfully tested against code bases with more than 5.000 PHP files.

Usage
=====

[](#usage)

```
Usage: php convert.php [-w]

```

Run the script with the path of the PHP file you wish to convert as argument. This will print the converted source code to STDOUT.

You can add the `-w` switch if you want to override the original file with the converted code.

If you want the script to process PHP files with short open tags (`
