From 83949aa6ed4f40e2f12a97cf8ffc68b1feb7f73f Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Fri, 29 Jun 2007 00:23:08 -0400 Subject: [PATCH] added format_int_0() --- format.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/format.php b/format.php index e158bb3..c40f55e 100644 --- a/format.php +++ b/format.php @@ -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); } -- 1.7.10.4