dg/php54-arrays

This package is abandoned and no longer maintained. No replacement package was suggested.

Command-line script to convert between array() and PHP 5.4's short syntax []

Maintainers

Details

github.com/dg/php54-arrays

Source

Installs: 231

Dependents: 0

Suggesters: 0

Security: 0

Stars: 45

Watchers: 10

Forks: 5

Type:project

v3 2015-05-26 16:23 UTC

This package is auto-updated.

Last update: 2020-01-24 20:41:15 UTC


README

Command-line script to convert between array() and PHP 5.4's short syntax [] (and vice versa).

It uses native PHP tokenizer, so conversion is safe. The script was successfully tested against thousands of PHP files.

Usage

To convert all *.php and *.phpt files in whole directory recursively or to convert a single file use:

php convert.php <directory | file>

To convert source code from STDIN and print the output to STDOUT use:

php convert.php < input.php > output.php

To convert short syntax [] to older long syntax array() use option --reverse:

php convert.php --reverse <directory | file>