aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2006-03-11 01:52:25 +0000
committerDavid M <davidmj@users.sourceforge.net>2006-03-11 01:52:25 +0000
commit1adfb39cbae433eccda37d50b7ed7a01bbabd4e3 (patch)
tree0d75a77cd1a41534039ea14b2ff9162b2842becc /phpBB/includes/functions.php
parent2fb1507670ba4582a1170c0346ef735358545a53 (diff)
downloadforums-1adfb39cbae433eccda37d50b7ed7a01bbabd4e3.tar
forums-1adfb39cbae433eccda37d50b7ed7a01bbabd4e3.tar.gz
forums-1adfb39cbae433eccda37d50b7ed7a01bbabd4e3.tar.bz2
forums-1adfb39cbae433eccda37d50b7ed7a01bbabd4e3.tar.xz
forums-1adfb39cbae433eccda37d50b7ed7a01bbabd4e3.zip
- Moved the image loading outside the big loop. This brings fewer comparisons and allows us to unload the image data sooner.
- Used a more appropriate method to break the images into chunks. git-svn-id: file:///svn/phpbb/trunk@5619 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 092c527902..e75ba650f0 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -175,6 +175,37 @@ if (!function_exists('array_combine'))
}
}
+if (!function_exists('str_split'))
+{
+ /**
+ * A wrapper for the PHP5 function str_split()
+ * @param array $string contains the string to be converted
+ * @param array $split_length contains the length of each chunk
+ *
+ * @return Converts a string to an array. If the optional split_length parameter is specified,
+ * the returned array will be broken down into chunks with each being split_length in length,
+ * otherwise each chunk will be one character in length. FALSE is returned if split_length is
+ * less than 1. If the split_length length exceeds the length of string, the entire string is
+ * returned as the first (and only) array element.
+ */
+ function str_split($string, $split_length = 1)
+ {
+ if ($split_length < 1)
+ {
+ return false;
+ }
+ else if ($split_length >= strlen($string))
+ {
+ return array($string);
+ }
+ else
+ {
+ preg_match_all('#.{1,' . $split_length . '}#s', $string, $matches);
+ return $matches[0];
+ }
+ }
+}
+
/**
* Get userdata
* @param mixed $user user id or username