Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- {x1,x2,x3,x4}
- {y1,y2,y3,y4,y5}
- */
- require_once "./ProgramJAO.php";
- $program = new ProgramJAO();
- $program->main();
- print_r($program->wynik);
- $zbiory = $program->wynik;
- echo "<br>";
- //echo "<br>".count($zbiory)."<br>";
- //SUMA
- $suma = $zbiory[0];
- print_r($suma);
- echo "<br>SUMA: ";
- for ($i=1;$i<count($zbiory);$i++)
- {
- foreach ($zbiory[$i] as $element)
- {
- if(!(in_array($element,$suma)))
- $suma[]=$element;
- }
- }
- print_r($suma);
- //SUMA_END
- //ROZNICA
- $roznica = $zbiory[0];
- echo "<p>ROZNICA START: ";print_r($roznica);echo "<br>";
- for ($i=1;$i<count($zbiory);$i++)
- {
- foreach ($zbiory[$i] as $element)
- {
- foreach ($roznica as $test)
- {
- if($test === $element)
- {
- array_splice($roznica,array_search($test, $roznica),1);
- }
- }
- }
- }
- echo "<br>ROZNICA: ";
- print_r($roznica);
- //ROZNICA_END
- //ILOCZYN
- $iloczyn = array_intersect($zbiory[0],$zbiory[1]);
- echo "<p>ILOCZYN START: ";print_r($iloczyn);echo "<br>";
- for ($i=2;$i<count($zbiory);$i++)
- $iloczyn=array_intersect($iloczyn,$zbiory[$i]);
- echo "<br>ILOCZYN: ";
- print_r($iloczyn);
- //ILOCZYN_END
- //GREATEST
- $suma_tmp = $zbiory[0];
- for ($i=1;$i<count($zbiory);$i++)
- {
- foreach ($zbiory[$i] as $element)
- {
- if(!(in_array($element,$suma_tmp)))
- $suma_tmp[]=$element;
- }
- }
- asort($suma_tmp);
- echo "<p>";
- print_r($suma_tmp);
- echo "<p>NAJWIEKSZY: ".end($suma_tmp)."<br>";
- //GREATEST_END
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement