I am working on a project and part of the process is to check which version of software installed on the host server, specifically Git for this case. From the command line I can run git --version which would return something similar to:
git version 1.8.5.2 (Apple Git-48)
I can use the following code to return the value from the command.
<?php
$gitVersion = exec('git --version');
return $gitVersion;
?>
However, is there a more efficient way to have the output look like the following:
1.8.5.5
git versionhas a fixed length, using substrings is probably easier.