fix new line
This commit is contained in:
13
tools/transfer-array.php
Normal file
13
tools/transfer-array.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
// transfer [] to array()
|
||||
|
||||
$file = $argv[1];
|
||||
$text = file_get_contents($file);
|
||||
|
||||
$text = preg_replace("/= \[([^;]*)\];/s", "= array(\\1);", $text);
|
||||
$text = preg_replace("/(\(| )\[([^\n]*?)\]\)/", "\\1array(\\2))", $text);
|
||||
$text = preg_replace("/(\(| )\[([^\n]*?)\],/", "\\1array(\\2),", $text);
|
||||
|
||||
file_put_contents($file, $text);
|
||||
|
||||
Reference in New Issue
Block a user