User:Niaht Nakamichi/PHP Code
< User:Niaht Nakamichi
Jump to navigation
Jump to search
Revision as of 12:21, 29 July 2008 by Niaht Nakamichi (talk | contribs) (New page: == is_uuid == <php> function is_uuid($uuid) { $lengths = array(8, 4, 4, 4, 12); if (strlen($uuid) !== 36) return false; $uuid = explode('-', $uuid); if (count($uuid) !== 5) r...)
is_uuid
<php> function is_uuid($uuid) { $lengths = array(8, 4, 4, 4, 12);
if (strlen($uuid) !== 36) return false;
$uuid = explode('-', $uuid);
if (count($uuid) !== 5) return false;
foreach($uuid as $key => $value) {
if (strlen($value) !== $lengths[$key]) return false;
if (!ctype_xdigit($value)) return false;
}
return true; } </php>