Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- file_put_contents("lab14src.txt", file_get_contents($_SERVER['SCRIPT_FILENAME']));
- echo "File To Array:\n";
- print_r(preg_split("/[\s,]+/", file_get_contents("file1.txt")));
- echo "\n\n";
- $file1 = file("file1.txt");
- $file2 = file("file2.txt");
- $file3 = file("file3.txt");
- for ($i=0; $i<count($file1); $i++)
- echo trim($file1[$i])." <=> ".
- trim($file2[$i])." <=> ".
- trim($file3[$i])." \n";
- echo "\n\n";
- echo "File1 ^ File2\n";
- print_r(array_intersect($file1, $file2));
- echo "\n";
- echo "File1 without File1 ^ File2 rows:\n";
- print_r(array_diff($file1, array_intersect($file1, $file2)));
- echo "\n\n";
- $syms1 = join(" ", $file1);
- $syms2 = join(" ", $file2);
- echo "Symbols File2^File1:\n";
- $symbols = array_intersect(str_split($syms1), str_split($syms2));
- echo join(array_flip(array_flip($symbols)));
- echo "\n\n";
- ?>
- File To Array:
- Array
- (
- [0] => Apple
- [1] => Bespin
- [2] => Doring
- [3] => Unix
- [4] => System
- [5] => Stuff
- [6] => Release
- [7] => Build
- [8] => Complete
- [9] =>
- )
- Apple Bespin Doring <=> Apple Bespin Doring <=> File3 Row1
- Unix System Stuff <=> Trinity Observer Pattern <=> File3 Row2
- Release Build Complete <=> Release Build Complete <=> File3 Row3
- File1 ^ File2
- Array
- (
- [0] => Apple Bespin Doring
- [2] => Release Build Complete
- )
- File1 without File1 ^ File2 rows:
- Array
- (
- [1] => Unix System Stuff
- )
- Symbols File2^File1:
- Aple BsinDorg
- ytmuRadC
- Apple Bespin Doring
- Unix System Stuff
- Release Build Complete
- Apple Bespin Doring
- Trinity Observer Pattern
- Release Build Complete
- File3 Row1
- File3 Row2
- File3 Row3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement