Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
/ php54-arrays Public archive

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

Notifications You must be signed in to change notification settings

dg/php54-arrays

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP 5.4 Short Arrays Converter []

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>

About

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

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages