ctype_digit()Yoast 1.0

Emulate PHP native ctype_digit() function for when the ctype extension would be disabled sigh. Only emulates the behaviour for when the input is a string, does not handle integer input as ascii value.

Хуков нет.

Возвращает

true|false.

Использование

ctype_digit( $text );
$text(строка) (обязательный)
String input to validate.

Код ctype_digit() Yoast 22.3

function ctype_digit( $text ) {
	$return = false;
	if ( ( is_string( $text ) && $text !== '' ) && preg_match( '`^\d+$`', $text ) === 1 ) {
		$return = true;
	}

	return $return;
}