rendered paste body<?php
// In the graph class....
public function get_graph_values($input) {
$answers_array = array();
for($i = -10.0; $i <= 11.0; $i = ($i + 0.1)){
$evaluating_input = str_replace('x', '(' . $i . ')', $input);
$evaluating_input = '$evaluated_input = ' . $evaluating_input . ';';
eval($evaluating_input);
$y = $evaluated_input;
$x = $i;
$answers_array[$x] = $y;
}
return $answers_array;
}
// On a test page, after creating $graph as an instance of the graph class...
$answers_array = $graph->get_graph_values($input_function);
print_r($answers_array);
die();
?>