is there a system variable that I can use to display the current version of the PHP runtime program...apache etc.?
I think you need phpinfo().
http://www.php.net/manual/function.phpversion.php
The example in user comments is useful for some things too, such as if version = 3 then do this, etc.