summaryrefslogtreecommitdiffstats
path: root/system/codeigniter/Common.php
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2009-07-28 16:42:12 +0200
committerDerek Jones <derek.jones@ellislab.com>2009-07-28 16:42:12 +0200
commit086ee5a06dc2a9b8273574c8c883efdbaa815765 (patch)
tree9de1aebb62af95c2c397b9826494f3653bfe4001 /system/codeigniter/Common.php
parent1414987474e8d9a96e640ba9378d447677cfc387 (diff)
add is_php() to Common.php
Diffstat (limited to 'system/codeigniter/Common.php')
-rw-r--r--system/codeigniter/Common.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/system/codeigniter/Common.php b/system/codeigniter/Common.php
index 340be2454..39005f602 100644
--- a/system/codeigniter/Common.php
+++ b/system/codeigniter/Common.php
@@ -30,6 +30,29 @@
// ------------------------------------------------------------------------
/**
+* Determines if the current version of PHP is greater then the supplied value
+*
+* Since there are a few places where we conditionally test for PHP > 5
+* we'll set a static variable.
+*
+* @access public
+* @return bool
+*/
+ function is_php($version = '5.0.0')
+ {
+ static $_is_php;
+
+ if ( ! isset($_is_php[$version]))
+ {
+ $_is_php[$version] = (version_compare(PHP_VERSION, $version) < 0) ? FALSE : TRUE;
+ }
+
+ return $_is_php[$version];
+ }
+
+// ------------------------------------------------------------------------
+
+/**
* Tests for file writability
*
* is_writable() returns TRUE on Windows servers when you really can't write to