function format_money( $STR ) { if ( $STR == "" ) { return ""; } if ( $STR == ".00" ) { return "0.00"; } $TOK = strtok( $STR, "." ); if ( strcmp( $STR, $TOK ) == "0" ) { $STR .= ".00"; } else { $TOK = strtok( "." ); $I = 1; for ( ; $I <= 2 - strlen( $TOK ); $I ) { $STR .= "0"; } } if ( substr( $STR, 0, 1 ) == "." ) { $STR = "0".$STR; } return $STR; } |