Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function a($a, $b, $c) {
- $d = $b * $b - 4 * $a * $c;
- if ($d < 0) return false;
- $x1 = (-$b + sqrt($d)) / (2 * $a);
- $x2 = (-$b - sqrt($d)) / (2 * $a);
- $res = [
- 'x1' => $x1,
- 'x2' => $x2
- ];
- return $res;
- }
- echo '<pre>';
- var_dump(a(1, 1, -6));
- echo '</pre>';
Advertisement
Add Comment
Please, Sign In to add comment