testOperations.php 601 B

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