1*6589c60cSAndreas Gohr<?php 2*6589c60cSAndreas Gohr/** 3*6589c60cSAndreas Gohr * compatibility functions 4*6589c60cSAndreas Gohr * 5*6589c60cSAndreas Gohr * This file contains a few functions that might be missing from the PHP build 6*6589c60cSAndreas Gohr */ 7*6589c60cSAndreas Gohr 8*6589c60cSAndreas Gohrif(!function_exists('ctype_space')) { 9*6589c60cSAndreas Gohr /** 10*6589c60cSAndreas Gohr * Check for whitespace character(s) 11*6589c60cSAndreas Gohr * 12*6589c60cSAndreas Gohr * @see ctype_space 13*6589c60cSAndreas Gohr * @param string $text 14*6589c60cSAndreas Gohr * @return bool 15*6589c60cSAndreas Gohr */ 16*6589c60cSAndreas Gohr function ctype_space($text) { 17*6589c60cSAndreas Gohr if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars 18*6589c60cSAndreas Gohr if(trim($text) === '') return true; 19*6589c60cSAndreas Gohr return false; 20*6589c60cSAndreas Gohr } 21*6589c60cSAndreas Gohr} 22*6589c60cSAndreas Gohr 23*6589c60cSAndreas Gohrif(!function_exists('ctype_digit')) { 24*6589c60cSAndreas Gohr /** 25*6589c60cSAndreas Gohr * Check for numeric character(s) 26*6589c60cSAndreas Gohr * 27*6589c60cSAndreas Gohr * @see ctype_digit 28*6589c60cSAndreas Gohr * @param string $text 29*6589c60cSAndreas Gohr * @return bool 30*6589c60cSAndreas Gohr */ 31*6589c60cSAndreas Gohr function ctype_digit($text) { 32*6589c60cSAndreas Gohr if(!is_string($text)) return false; #FIXME original treats between -128 and 255 inclusive as ASCII chars 33*6589c60cSAndreas Gohr if(preg_match('/^\d+$/', $text)) return true; 34*6589c60cSAndreas Gohr return false; 35*6589c60cSAndreas Gohr } 36*6589c60cSAndreas Gohr}