From 2bc7f85a58fd4e9267fed7af06af157cf787a194 Mon Sep 17 00:00:00 2001 From: Taras Machyshyn Date: Mon, 9 Feb 2015 17:07:06 +0200 Subject: [PATCH] added getPhpVersion() --- application/Espo/Core/Utils/System.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/application/Espo/Core/Utils/System.php b/application/Espo/Core/Utils/System.php index 6cfa2c4181..6ca94c9b37 100644 --- a/application/Espo/Core/Utils/System.php +++ b/application/Espo/Core/Utils/System.php @@ -101,4 +101,20 @@ class System { return (defined("PHP_BINDIR"))? PHP_BINDIR.DIRECTORY_SEPARATOR.'php' : 'php'; } + + /** + * Get php version (only digits and dots) + * + * @return string + */ + public static function getPhpVersion() + { + $version = phpversion(); + + if (preg_match('/^[0-9\.]+[0-9]/', $version, $matches)) { + return $matches[0]; + } + + return $version; + } } \ No newline at end of file