$nextTester = getTotalTesterUsers();
// Prepend zeros
- $nextTester = prependZeros($nextTester, 6);
+ $nextTester = padLeftZero($nextTester, 6);
// Return it
return $nextTester;
}
// Fills (prepend) a string with zeros. This function has been taken from user comments at de.php.net/str_pad
-function prependZeros ($mStretch, $length = 2) {
+function prependZeros ($str, $length = 2) {
// Return prepended string
- return sprintf('%0' . (int) $length . 's', $mStretch);
+ return sprintf('%0' . (int) $length . 's', $str);
}
// Wraps convertSelectionsToEpocheTime()
// Wrapper for str_pad() with left padding zeros
function padLeftZero ($str, $amount = 2) {
- // Pad it
- return str_pad($str, $amount, '0', STR_PAD_LEFT)
+ // Is str_pad() there?
+ if (function_exists('str_pad')) {
+ // Use prependZeros()
+ return prependZeros($str, $amount);
+ } else {
+ // Pad it
+ return str_pad($str, $amount, '0', STR_PAD_LEFT)
+ }
}
// [EOF]