__(Added `[code]…[/code]
Fatal error: Uncaught Error: Function name must be a string in C:xampphtdocsLearningPhpindex.php:32 Stack trace: #0 {main} thrown in C:xampphtdocsLearningPhpindex.php on line 32
i get the error above, can any one help me on this ?
my source code are as shown bwlow
[code]
<html>
<head>
<meta charset=”UTF-8″>
<title></title>
</head>
<body>
<?php
// define a class called operation
class operation
{
// defining function add and sub
function add($val1, $val2)
{
$sum = $val1+ $val2;
echo “Sum = “.$sum. “</br>”;
}
function sub ($val1, $val2)
{
$sub = $val1 – $val2;
echo “Defference = “.$sub.”</br>”;
}
}
// craeting object calle solve to access the clas operation
$solve = new operation();
// accessing the methods in class operation
$solve-> add($_GET(‘f’), $_GET(‘s’));
$solve-> sub($_GET(‘f’), $_GET(‘s’));
?>
<form>
enter first value <input type =”text” name =”f”/><hr>
enter second value <input type =”text” name =”s”/><hr>
<input type=”submit” value=”Show result”/>
</form>
</body>
</html>