]> git.mxchange.org Git - mailer.git/blobdiff - inc/wrapper-functions.php
More usage of padLeftZero() instead of prependZeros() but use prependZeros() as a...
[mailer.git] / inc / wrapper-functions.php
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]