testOperations.php 559 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. use Complex\Complex as Complex;
  3. include('../classes/Bootstrap.php');
  4. $values = [
  5. new Complex(123),
  6. new Complex(456, 123),
  7. new Complex(0.0, 456),
  8. ];
  9. foreach ($values as $value) {
  10. echo $value, PHP_EOL;
  11. }
  12. echo 'Addition', PHP_EOL;
  13. $result = \Complex\add(...$values);
  14. echo '=> ', $result, PHP_EOL;
  15. echo PHP_EOL;
  16. echo 'Subtraction', PHP_EOL;
  17. $result = \Complex\subtract(...$values);
  18. echo '=> ', $result, PHP_EOL;
  19. echo PHP_EOL;
  20. echo 'Multiplication', PHP_EOL;
  21. $result = \Complex\multiply(...$values);
  22. echo '=> ', $result, PHP_EOL;