Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $separator = '//';
- $file = '';
- foreach ($argv as $argNum => $argVal) {
- if ($argVal == '-file') {
- $file = $argv[$argNum + 1];
- }
- if ($argVal == '-separator') {
- $separator = $argv[$argNum + 1] . ' ';
- }
- }
- $content = file($file);
- $res = array();
- foreach ($content as $line) {
- $line = trim($line);
- if (false !== strpos($line, $separator)) {
- $res[] = str_replace($separator, '', $line);
- }
- }
- $res = iconv('windows-1251', 'utf8', implode(PHP_EOL, $res));
- echo $res;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement