JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added format_int_0()
authorJason Woofenden <jason183@herkamire.com>
Fri, 29 Jun 2007 04:23:08 +0000 (00:23 -0400)
committerJason Woofenden <jason183@herkamire.com>
Fri, 29 Jun 2007 04:23:08 +0000 (00:23 -0400)
format.php

index e158bb3..c40f55e 100644 (file)
@@ -45,6 +45,15 @@ function format_int($str) {
        return ereg_replace('^0*([1-9])', '\1', $str);
 }
 
+# return 0 of there's no digits
+function format_int_0($str) {
+       $str = format_int($str);
+       if($str == '') {
+               return '0';
+       }
+       return $str;
+}
+
 function format_zip($str) {
        return ereg_replace('[^0-9]', '', $str);
 }