1<?php 2/** 3 * Polyfill-CType 4 * 5 * @link https://github.com/nomadjimbob/polyfill-ctype 6 * @author James Collins <james.collins@outlook.com.au> 7 * @license GPLv2 (http://www.gnu.org/licenses/gpl-2.0.html) 8 */ 9 10if(!function_exists('ctype_alnum')) { 11 function ctype_alnum($var) { 12 return preg_match('/^[a-zA-Z0-9]+$/', $var); 13 } 14} 15 16if(!function_exists('ctype_alpha')) { 17 function ctype_alpha($var) { 18 return preg_match('/^[a-zA-Z]+$/', $var); 19 } 20} 21 22if(!function_exists('ctype_cntrl')) { 23 function ctype_cntrl($var) { 24 return preg_match('/^[\x00-\x1F\x7F]+$/', $var); 25 } 26} 27 28if(!function_exists('ctype_digit')) { 29 function ctype_digit($var) { 30 return preg_match('/^[0-9]+$/', $var); 31 } 32} 33 34if(!function_exists('ctype_graph')) { 35 function ctype_graph($var) { 36 return preg_match('/^[\x20-\x7E\x80-\xFF]+$/', $var); 37 } 38} 39 40if(!function_exists('ctype_lower')) { 41 function ctype_lower($var) { 42 return preg_match('/^[a-z]+$/', $var); 43 } 44} 45 46if(!function_exists('ctype_print')) { 47 function ctype_print($var) { 48 return preg_match('/^[\x20-\x7E\x80-\xFF]+$/', $var); 49 } 50} 51 52if(!function_exists('ctype_punct')) { 53 function ctype_punct($var) { 54 return preg_match('/^[^\w\s]+$/', $var); 55 } 56} 57 58if(!function_exists('ctype_space')) { 59 function ctype_space($var) { 60 return preg_match('/^[\r\t\n]+$/', $var); 61 } 62} 63 64if(!function_exists('ctype_upper')) { 65 function ctype_upper($var) { 66 return preg_match('/^[A-Z]+$/', $var); 67 } 68} 69 70if(!function_exists('ctype_xdigit')) { 71 function ctype_upper($var) { 72 return preg_match('/^[0-9A-Fa-f]+$/', $var); 73 } 74} 75 76?>