Category Archives: PHP

PHP function to validate MySQL UUID or GUID

/** * Function to validate a generated GUID / UUID * @param string $guid GUID * @return bool */ function validGUID($guid){ return preg_match(‘#^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$#’, $guid); } Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share with Stumblers … Continue reading

Posted in MySQL, PHP | Tagged , | Leave a comment

PHP function to emulate MySQL UUID

/** * uuid * * uuid() simply replicates MySQL’s UUID function, which returns a 36 * character "random" hash (32 alphanumeric, 4 dashes). * @return string */ function uuid(){ return sprintf(‘%04x%04x-%04x-%04x-%04x-%04x%04x%04x’, mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | … Continue reading

Posted in MySQL, PHP | Tagged , | Leave a comment

PHP function to emulate Excel NormSInv

<?php function NormSInv($p){ $a1 = -39.6968302866538; $a2 = 220.946098424521; $a3 = -275.928510446969; $a4 = 138.357751867269; $a5 = -30.6647980661472; $a6 = 2.50662827745924; $b1 = -54.4760987982241; $b2 = 161.585836858041; $b3 = -155.698979859887; $b4 = 66.8013118877197; $b5 = -13.2806815528857; $c1 = -7.78489400243029E-03; $c2 … Continue reading

Posted in Excel, PHP | Tagged , , | Leave a comment