More usage of padLeftZero() instead of prependZeros() but use prependZeros() as a...
authorRoland Häder <roland@mxchange.org>
Wed, 9 Jan 2013 05:17:43 +0000 (05:17 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 9 Jan 2013 05:17:43 +0000 (05:17 +0000)
inc/libs/user_functions.php
inc/wrapper-functions.php

index 2477532023cd1bff8db168ceda2a8236551611c0..9a02c876fef9bb138f8c58845fe1950de2c8ca24 100644 (file)
@@ -759,7 +759,7 @@ function getNextFreeTesterUserNumber () {
        $nextTester = getTotalTesterUsers();
 
        // Prepend zeros
-       $nextTester = prependZeros($nextTester, 6);
+       $nextTester = padLeftZero($nextTester, 6);
 
        // Return it
        return $nextTester;
index c93614228856e74356000349488ad3698e0213b9..1593901d6a293938a3a367b21c3906357b164cd4 100644 (file)
@@ -3245,9 +3245,9 @@ function determineWhat ($module = NULL) {
 }
 
 // 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()
@@ -3412,8 +3412,14 @@ function shift_array (&$array, $value, $key = '0') {
 
 // 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]