Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function parseShittyFile($string) {
- // daca functia va primi un STRING si nu un FISIER, comenteaza linia de mai jos
- $string = file_get_contents($string);
- preg_match_all('#-A (\w+)#', $string, $a);
- preg_match_all('#-j (\w+)#', $string, $j);
- foreach (array_unique($j[1]) as $j_parameter) {
- if (!in_array($j_parameter, array_unique($a[1]))) {
- $string = str_replace("-j $j_parameter", "-j " . strtoupper($j_parameter), $string);
- }
- }
- return $string;
- }
- // mod de folosire (a se servi calda):
- echo parseShittyFile("string_file.txt");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement