Skip to content

Instantly share code, notes, and snippets.

@joshribakoff joshribakoff/gist:6852259
Last active Dec 24, 2015

Embed
What would you like to do?
Shorten the docblocks, multi file recursive multi-line find & replace
<?php
/** Enable blash globbing, or run with zsh instead of bash */
`ls **/*.php > list.txt`;
$find = "/**
* Vehicle Fits (http://www.vehiclefits.com for more information.)
* @copyright Copyright (c) Vehicle Fits, llc
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/";
$replace = "/**
* Vehicle Fits (http://www.vehiclefits.com for more information.)
* @copyright Copyright (c) Vehicle Fits, llc
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/";
$files = explode("\n", file_get_contents('list.txt'));
foreach($files as $file) {
$code = file_get_contents($file);
$code = str_replace($find, $replace, $code);
file_put_contents($file, $code);
echo $file . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.