<?php
$string='ถังบำบัดน้ำเสีย 20,000 ลิตร';
$string1='123456789012345678901234567890123456789012345678901234567890';

// Get string length for Character Thai
//array getMBStrSplit ( string $string [, int $split_length = 1 ] )
// Get string length for Character Thai
function getStrLenTH($string)
{
	$array = getMBStrSplit($string);
	$count = 0;
	
	foreach($array as $value)
	{
		$ascii = ord(iconv("UTF-8", "TIS-620", $value ));
		
		if( !( $ascii == 209 ||  ($ascii >= 212 && $ascii <= 218 ) || ($ascii >= 231 && $ascii <= 238 )) )
		{
			$count += 1;
		}
	}
	return $count;
}
$str=getStrLenTH($string);
print_r($str);
?>