Skip to content

Instantly share code, notes, and snippets.

View inventor96's full-sized avatar

Caleb Hornbeck inventor96

View GitHub Profile
@inventor96
inventor96 / fix_unquoted_array_keys.php
Last active April 23, 2024 20:16
Recursively finds and fixes unquoted array keys in PHP. This is not full-proof, nor does it cover 100% of all occurrences, but it gets really close at getting nearly all of them. See the respective sources for discussion and limitations of each function.
#!/usr/bin/php
<?php
/**
* Run this script on the command line like `php fix_unquoted_array_keys.php './*.php'`
* Or make the file executable and run it directly.
*
* As the first argument after the script name gets passed directly to `rglob()`, it's
* recommended that you quote it to prevent the shell from doing the expansion itself.
*/