Difference between revisions of "User:Niaht Nakamichi/PHP Code"
Jump to navigation
Jump to search
m (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...) |
m (→is_uuid) |
||
Line 11: | Line 11: | ||
if (count($uuid) !== 5) | if (count($uuid) !== 5) | ||
return false; | return false; | ||
foreach($uuid as $key => $value) { | foreach($uuid as $key => $value) { |
Revision as of 12:27, 29 July 2008
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>