4.3 - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of 4.3.php
- <?php
- $a = 1;
- $b = -5;
- $c = 6;
- $D = $b * $b - 4 * $a * $c;
- if ($D > 0) {
- $x1 = (-$b + sqrt($D)) / (2 * $a);
- $x2 = (-$b - sqrt($D)) / (2 * $a);
- echo "Уравнение имеет два корня: x1 = $x1, x2 = $x2";
- } elseif ($D == 0) {
- $x1 = $x2 = -$b / (2 * $a);
- echo "Уравнение имеет один корень: x1 = x2 = $x1";
- } else {
- echo "Уравнение не имеет действительных корней";
- }
- ?>