Difference between revisions of "User:Niaht Nakamichi/PHP Code"
Jump to navigation
Jump to search
m (→is_uuid) |
m |
||
Line 2: | Line 2: | ||
<php> | <php> | ||
function is_uuid($uuid) { | function is_uuid($uuid) { | ||
if (strlen($uuid) !== 36) return false; | |||
if (strpos($uuid, '-') !== 8) return false; | |||
if (strlen($uuid) !== 36) | if (strpos($uuid, '-', 9) !== 13) return false; | ||
if (strpos($uuid, '-', 14) !== 18) return false; | |||
if (strpos($uuid, '-', 19) !== 23) return false; | |||
if (ctype_xdigit(str_replace('-', '', $uuid)) == false) return false; | |||
if ( | |||
return true; | return true; | ||
} | } | ||
</php> | </php> |
Revision as of 13:24, 29 July 2008
is_uuid
<php> function is_uuid($uuid) { if (strlen($uuid) !== 36) return false; if (strpos($uuid, '-') !== 8) return false; if (strpos($uuid, '-', 9) !== 13) return false; if (strpos($uuid, '-', 14) !== 18) return false; if (strpos($uuid, '-', 19) !== 23) return false; if (ctype_xdigit(str_replace('-', , $uuid)) == false) return false; return true; } </php>