Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
function expression($x) {
$result = (abs($x-5)-sin($x))/3+(sqrt($x*$x+2014)*cos(2*$x)-3);
$result = round($result, 5);
return $result;
}
?>
<?php
if (isset($_POST['x']) and is_numeric($_POST['x'])) {
$x = $_POST['x'];
} else {
$x = 0;
}
?>
<html>
<head>
<meta charset="utf8" />
</head>
<body>
<form method="post">
Введите x <input type="text" name="x" value="<?php echo $x; ?>">
<input type="submit" value="Вычислить">
</form>
<div>
<?php echo "(|x−5|−sin(x))/3+√x^2+2014⋅cos(2x)−3 = " . expression($x) . "; при x = $x"; ?>
</div>
</body>
</html>