sudokuObjectFromString($sudokustring); $answer = $sudokuObj->suggestionString($srow,$scolumn); if(strlen($answer) == 25) { echo "All numbers from 1 to 9."; } elseif(strlen($answer) > 1) { echo $answer . "."; } elseif(strlen($answer) == 0) { echo "No suggestions."; } else { echo "The only option left for this box is " . $answer . "."; } } catch (SudokuException $e) { echo $sudokuObj; echo "An exception was thrown."; } } elseif ($mode == "nextsteps") { // Return a string with coordinates that have only one // option left $sudokuObj = new SudokuObject; try { $sudokuObj->sudokuObjectFromString($sudokustring); $answer = $sudokuObj->nextSteps(); echo $answer; } catch (SudokuException $e) { echo "An exception was thrown."; } } elseif ($mode == "autofill") { // Return the coordinates of box we'll fill next $sudokuObj = new SudokuObject; try { $sudokuObj->sudokuObjectFromString($sudokustring); $answer = $sudokuObj->autoFill(); echo $answer; } catch (SudokuException $e) { echo "An exception was thrown."; } } elseif ($mode == "load") { // Load an array with difficulty level $level $sudokuObj = new SudokuObject; try { $sudokuObj->sudokuObjectFromDatabase($level); $answer = $sudokuObj; echo $answer; } catch (SudokuException $e) { echo "An exception was thrown."; } } ?>