読者です 読者をやめる 読者になる 読者になる

memo

memo dayo.

[php] 半角記号を全角記号に置換する

php
// ==============================================
function han2zen ($str_prm){
/*
	$ary_han = array(
					 "\\"
					,"'"
					,'"'
					,'~'
				);
	$ary_zen = array(
					 '¥'
					,'’'
					,'”'
					,'~'
				);
	$str_prm = str_replace($ary_han, $ary_zen, $str_prm);
	$ary_han = array();
	$int_code = ord(' ');
	while(true){
		if(ctype_alnum(chr($int_code)) !== false){
			$int_code++;
			continue;
		}
		$ary_han[] = chr($int_code);
		if(chr($int_code) === '~'){
			break;
		}
		$int_code++;
	}
	$ary_zen = array();
	foreach ($ary_han as $str_han) {
		$ary_zen[] = mb_convert_kana($str_han , 'A' , 'UTF-8');
	}
*/
	$ary_han = array(
					 ' '
					,'!'
					,'"'
					,'#'
					,'$'
					,'%'
					,'&'
					,"'"
					,'('
					,')'
					,'*'
					,'+'
					,','
					,'-'
					,'.'
					,'/'
					,':'
					,';'
					,'<'
					,'='
					,'>'
					,'?'
					,'@'
					,'['
					,"\\"
					,']'
					,'^'
					,'_'
					,'`'
					,'{'
					,'|'
					,'}'
					,'~'
				);
	$ary_zen = array(
					 ' '
					,'!'
					,'”'
					,'#'
					,'$'
					,'%'
					,'&'
					,'’'
					,'('
					,')'
					,'*'
					,'+'
					,','
					,'-'
					,'.'
					,'/'
					,':'
					,';'
					,'<'
					,'='
					,'>'
					,'?'
					,'@'
					,'['
					,'¥'
					,']'
					,'^'
					,'_'
					,'`'
					,'{'
					,'|'
					,'}'
					,'~'
				);
	$str_prm = str_replace($ary_han, $ary_zen, $str_prm);
	return $str_prm;
}
// ==============================================
広告を非表示にする