Scripting is fairly simple if you already know the command line and output.
So tell us exactly what you type to check it manually and what you see when you type that and it should be simple for us to tell you what should be in your script.
For example if you type "php -v" and it outputs something like:
PHP 5.1.6 (cli) (built: Apr 7 2009 08:00:04)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
And you wanted to find whether it had Zend your script could be as simple as:
if php -v |grep Zend
then echo Zend is installed
else echo Zend is NOT installed
The above simply checks to see if Zend appears in the output of php -v. If it does then it prints a message saying it is installed. Otherwise it prints a message saying it is not installed.