Public feed #599978

Geoffrey Sneddon's shitty code (

public php v1 · immutable
Raw Edit
·published 2007-07-02 15:31 UTC
rendered paste body
<?php/** * See if a string is a valid hexadecimal colour * * @param string $str Input String * @return bool Returns true if str is a valid hexadecimal colour, false otherwise */ function valid_hex_colour($str){	$len=strlen($str);	return (($len==4||$len==7)&&$str[0]=='#'&&strspn(substr($str, 1),'0123456789abcdefABCDEF')==$len-1);}if(valid_hex_colour('#DDd')){	echo "valid!";}else{	echo "invalid!"}?>