Is it possible to build an application with PHP which automatically responds to each form submission?
Like this:

So, for example, if the form submission were $_POST['q'] = "hi", the output would be “Hello..”
Like using a case statement:
for case $_POST['q'] = "how do you do?"
echo "fine";
for case $_POST['q'] = "what's your name ? "
echo "ABC"
etc. etc.
Can anyone help me out to build a function like that in PHP?
what I am thinking of is: for a form submission, there should be a print/echo from arrays just like how Siri on iOS works…
To implement siri. The task is much sophisticated which includes Tokenization, sentence segmentation, part-of-speech tagging, named entity extraction, chunking, parsing, coreference resolution and much more programming.
These links might help you.
ai-class
http://opennlp.apache.org/
http://nlp.stanford.edu/software/