public static function blocks_check($data, $blocks)
	{
		if (! ReflectionTypeHint::isValid()) return false;

		if (is_array($data))
		{
			foreach ($data as $k => &$v)
			{
				if (! self::blocks_check($k, $blocks) || ! self::blocks_check($v, $blocks)) return false;
			}
			return true;
		}

		if (is_string($data))
		{
			$chars = self::str_split($data);
			if ($chars === false) return false; #broken UTF-8
			unset($data); #memory free
			$skip = array(); #save to cache already checked symbols
			foreach ($chars as $i => $char)
			{
				if (array_key_exists($char, $skip)) continue; #speed improve
				$codepoint = self::ord($char);
				if ($codepoint === false) return false; #broken UTF-8
				$is_valid = false;
				$blocks = (array)$blocks;
				foreach ($blocks as $j => $block)
				{
					if (is_string($block))
					{
						if (! array_key_exists($block, self::$unicode_blocks))
						{
							trigger_error('Unknown block "' . $block . '"!', E_USER_WARNING);
							return false;
						}
						list ($min, $max) = self::$unicode_blocks[$block];
					}
					elseif (is_array($block)) list ($min, $max) = $block;
					elseif (is_int($block)) $min = $max = $block;
					else trigger_error('A string/array/int type expected for block[' . $j . ']!', E_USER_ERROR);
					if ($codepoint >= $min && $codepoint <= $max)
					{
						$is_valid = true;
						break;
					}
				}#foreach
				if (! $is_valid) return false;
				$skip[$char] = null;
			}#foreach
			return true;
		}
		if (is_scalar($data) || is_null($data)) return true;  #~ null, integer, float, boolean
		return false; #object or resource
	}
public static function blocks_check($data, $blocks)
	{
		if (! ReflectionTypeHint::isValid()) return false;

		if (is_array($data))
		{
			foreach ($data as $k => &$v)
			{
				if (! self::blocks_check($k, $blocks) || ! self::blocks_check($v, $blocks)) return false;
			}
			return true;
		}

		if (is_string($data))
		{
			$chars = self::str_split($data);
			if ($chars === false) return false; #broken UTF-8
			unset($data); #memory free
			$skip = array(); #save to cache already checked symbols
			foreach ($chars as $i => $char)
			{
				if (array_key_exists($char, $skip)) continue; #speed improve
				$codepoint = self::ord($char);
				if ($codepoint === false) return false; #broken UTF-8
				$is_valid = false;
				$blocks = (array)$blocks;
				foreach ($blocks as $j => $block)
				{
					if (is_string($block))
					{
						if (! array_key_exists($block, self::$unicode_blocks))
						{
							trigger_error('Unknown block "' . $block . '"!', E_USER_WARNING);
							return false;
						}
						list ($min, $max) = self::$unicode_blocks[$block];
					}
					elseif (is_array($block)) list ($min, $max) = $block;
					elseif (is_int($block)) $min = $max = $block;
					else trigger_error('A string/array/int type expected for block[' . $j . ']!', E_USER_ERROR);
					if ($codepoint >= $min && $codepoint <= $max)
					{
						$is_valid = true;
						break;
					}
				}#foreach
				if (! $is_valid) return false;
				$skip[$char] = null;
			}#foreach
			return true;
		}
		if (is_scalar($data) || is_null($data)) return true;  #~ null, integer, float, boolean
		return false; #object or resource
	}
public static function blocks_check ( $ data , $ blocks ) { if ( ! ReflectionTypeHint :: isValid ( ) ) return false ; if ( is_array ( $ data ) ) { foreach ( $ data as $ k => & $ v ) { if ( ! self :: blocks_check ( $ k , $ blocks ) || ! self :: blocks_check ( $ v , $ blocks ) ) return false ; } return true ; } if ( is_string ( $ data ) ) { $ chars = self :: str_split ( $ data ) ; if ( $ chars === false ) return false ; #broken UTF-8
 unset ( $ data ) ; #memory free
 $ skip = array ( ) ; #save to cache already checked symbols
 foreach ( $ chars as $ i => $ char ) { if ( array_key_exists ( $ char , $ skip ) ) continue ; #speed improve
 $ codepoint = self :: ord ( $ char ) ; if ( $ codepoint === false ) return false ; #broken UTF-8
 $ is_valid = false ; $ blocks = ( array ) $ blocks ; foreach ( $ blocks as $ j => $ block ) { if ( is_string ( $ block ) ) { if ( ! array_key_exists ( $ block , self :: $ unicode_blocks ) ) { trigger_error ( 'Unknown block "' . $ block . '"!' , E_USER_WARNING ) ; return false ; } list ( $ min , $ max ) = self :: $ unicode_blocks [ $ block ] ; } elseif ( is_array ( $ block ) ) list ( $ min , $ max ) = $ block ; elseif ( is_int ( $ block ) ) $ min = $ max = $ block ; else trigger_error ( 'A string/array/int type expected for block[' . $ j . ']!' , E_USER_ERROR ) ; if ( $ codepoint >= $ min && $ codepoint <= $ max ) { $ is_valid = true ; break ; } } #foreach
 if ( ! $ is_valid ) return false ; $ skip [ $ char ] = null ; } #foreach
 return true ; } if ( is_scalar ( $ data ) || is_null ( $ data ) ) return true ; #~ null, integer, float, boolean
 return false ; #object or resource
 }
Check the data in UTF-8 charset on given ranges of the standard UNICODE.
The suitable alternative to regular expressions.

For null, integer, float, boolean returns TRUE.

Arrays traversed recursively (keys and values).
At least if one array element value is not passed checking, it returns FALSE.

@example
#A simple check the standard named ranges:
UTF8::blocks_check('поисковые системы Google и Yandex', array('Basic Latin', 'Cyrillic'));
#You can check the named, direct ranges or codepoints together:
UTF8::blocks_check('поисковые системы Google и Yandex', array(array(0x20, 0x7E),     #[\x20-\x7E]
array(0x0410, 0x044F), #[A-Яa-я]
0x0401, #russian yo (Ё)
0x0451, #russian ye (ё)
'Arrows',
));

@link    http://www.unicode.org/charts/
@param   array|scalar|null  $data
@param   array|string       $blocks
@return  bool               Возвращает TRUE, если все символы из текста принадлежат указанным диапазонам
и FALSE в противном случае или для разбитого UTF-8.
Check the data in UTF - 8 charset on given ranges of the standard UNICODE . The suitable alternative to regular expressions .