Difference between revisions of "User:Niaht Nakamichi/PHP Code"
Jump to navigation
Jump to search
m |
m (→is_uuid) |
||
Line 3: | Line 3: | ||
function is_uuid($uuid) { | function is_uuid($uuid) { | ||
if (strlen($uuid) !== 36) return false; | if (strlen($uuid) !== 36) return false; | ||
if (substr_count, $uuid, '-') !== 4) return false; | |||
if (strpos($uuid, '-') !== 8) return false; | if (strpos($uuid, '-') !== 8) return false; | ||
if (strpos($uuid, '-', 9) !== 13) return false; | if (strpos($uuid, '-', 9) !== 13) return false; |
Revision as of 13:27, 29 July 2008
is_uuid
<php> function is_uuid($uuid) { if (strlen($uuid) !== 36) return false; if (substr_count, $uuid, '-') !== 4) 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>