Location: PHPKode > scripts > Calorie Burning Calculator > calorie-burning-calculator/calorie_burning_calc_files/functions.php
<?php

	function getResultDiv($value,$type='error') {
		// Formats successful or error results whether they are in an array or a snippet.
		if ($type == 'success') {
			$class = 'success-div';
		} elseif ($type == 'test') {
			$class = 'test-div';
		} else {
			$class = 'error-div';
		}
		if (is_array($value)) {
			for ($i = 0; $value[$i] != ''; $i++) {
				$result_div .= '<li>' . $value[$i] . '</li>';
			}
			if ($result_div != '') {
				$result_div = '<div class="' . $class . '"><ul>' . $result_div . '</ul></div>';
			}
		} else {
			if ($value != '') {
				$result_div = '<div class="' . $class . '">' . $value . '</div>';
			}
		}
		return $result_div;
	}
	
	function checkValidChars($string,$valid_chars) {
		$string_array = str_split($string);
		$valid_chars_array = str_split($valid_chars);
		$i = 0;
		while ($string_array[$i] != '') {
			if (!in_array($string_array[$i],$valid_chars_array)) {
				return false;
			}
			$i++;
		}
		return true;
	}
	
	if (!function_exists('str_split')) {
		function str_split($string, $split_length = 1) {
			return explode("\r\n", chunk_split($string, $split_length));
		}
	}
?>
Return current item: Calorie Burning Calculator