before letters

php Добавляем процент к формату даты (перед буквами)

function addPercentToDateFormat($format)
{
	$percent_format = '';
	foreach (preg_split('//', $format, -1, PREG_SPLIT_NO_EMPTY) as $symbol) {
		if (ctype_alpha($symbol)) {
			$percent_format .= '%';
		}
		$percent_format .= ( $symbol == 'i' ) ? 'M' : $symbol;
	}
	return $percent_format;
}
Subscribe to RSS - before letters