samuelhauser
8/15/2014 - 6:51 AM

swissify

<?php
/**
 * Handles the money format.
 *
 * @access public
 * @param  int $price
 * @return int $price
 */
public static function swissify($price) {
	$money = 0;
	$pos1 = strrpos((string)$price, ",");

	if ($pos1 === false) {
		$money=(string)$price.".-";
	} else {
		$money=str_replace(",",".",(string)$price);
		$wert_array = explode(".", $money);
		if (count(count_chars($wert_array[1],1)) == 1) {
			$money.="0";
		}
	}
	
	return $money;
}
?>