Created
October 1, 2021 16:20
-
-
Save interduo/f02ce4e0ce6d220d43aaac7dc1b0bbed to your computer and use it in GitHub Desktop.
Revisions
-
interduo created this gist
Oct 1, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ <?php print 'TEST1: Duplikaty elementow w tablicy '; $a = [ 1, 2, 3]; $b = [ 1, 2, 3, 2]; $diff = array_diff($a, $b); $diff2 = array_diff($b, $a); if(empty($diff) && empty($diff2)) { print 'WYNIK: TAK '; } else { print 'WYNIK: NIE'; } print 'TEST2: Zamiana elementow miejscami w tablicy '; $a = [ 1, 2, 3]; $b = [ 3, 2, 1]; $diff = array_diff($a, $b); $diff2 = array_diff($b, $a); if(empty($diff) && empty($diff2)) { print 'WYNIK: TAK '; } else { print 'WYNIK: NIE '; } print 'TEST3: elementy w tablicy roznia sie '; $a = [ 1, 2, 3]; $b = [ 4, 3, 2, 1]; $diff = array_diff($a, $b); $diff2 = array_diff($b, $a); if(empty($diff) && empty($diff2)) { print 'WYNIK: TAK '; } else { print 'WYNIK: NIE '; } ?>