jjzjj

php - isHex() 和 isOcta() 函数

我有两个函数。IsOcta和isHex。似乎无法使isHex正常工作。isHex()中的问题是它不能省略原始字符串x23的'x'符号。原始十六进制也可以是D1CE。所以添加x然后进行比较是行不通的。isHex函数有没有正确的解法。isOcta也是正确的吗?functionisHex($string){(int)$x=hexdec("$string");//InputmustbeaStringandhexdecreturnsNUMBER$y=dechex($x);//MustbeaNumberanddechexreturnsSTRINGecho"isHex()-HexaNumberRec