3<title>Quadratic Equation Solver</title>
12set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) .
'/../Classes/');
15<h1>Quadratic Equation Solver</h1>
16<form action=
"Quadratic.php" method=
"POST">
17Enter the coefficients
for the Ax<sup>2</sup> + Bx +
C = 0
18<table border=
"0" cellpadding=
"0" cellspacing=
"0">
19 <tr><td><b>A </b></td>
20 <td><
input name=
"A" type=
"text" size=
"8" value=
"<?php echo (isset($_POST['A'])) ? htmlentities($_POST['A']) : ''; ?>"></td>
22 <tr><td><b>
B </b></td>
23 <td><
input name=
"B" type=
"text" size=
"8" value=
"<?php echo (isset($_POST['B'])) ? htmlentities($_POST['B']) : ''; ?>"></td>
25 <tr><td><b>
C </b></td>
26 <td><
input name=
"C" type=
"text" size=
"8" value=
"<?php echo (isset($_POST['C'])) ? htmlentities($_POST['C']) : ''; ?>"></td>
29<
input name=
"submit" type=
"submit" value=
"calculate"><br />
30If A=0, the equation is not quadratic.
35if (isset(
$_POST[
'submit'])) {
37 echo
'The equation is not quadratic';
40 include
'PHPExcel/IOFactory.php';
52 echo
'<hr /><b>Roots:</b><br />';
55 echo
$objPHPExcel->getActiveSheet()->getCell(
'B5')->getCalculatedValue().
'<br />';
56 echo
$objPHPExcel->getActiveSheet()->getCell(
'B6')->getCalculatedValue().
'<br />';
60 echo
'<hr />Call time for Quadratic Equation Solution was '.sprintf(
'%.4f',
$callTime).
' seconds<br /><hr />';
61 echo
' Peak memory usage: '.(memory_get_peak_usage(
true) / 1024 / 1024).
' MB<br />';
An exception for terminatinating execution or to throw for unit testing.
static load($pFilename)
Loads PHPExcel from file using automatic PHPExcel_Reader_IReader resolution.