This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @param st: The string that will be trimmed. @default whitespace | |
String.prototype.strim = function(st) { | |
st = st || "\\s"; | |
return this.replace(new RegExp("^"+st+"+|"+st+"+$",'g'),''); | |
} | |
/* | |
example: | |
"alorem ipsuma".strim('a'); // return "lorem ipsum" | |
" lorem ipsum ".strim(); // return "lorem ipsum" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @version 20150828 | |
*/ | |
function username($str) { | |
$bool = preg_match('/^[a-zA-Z][a-zA-Z0-9_]+$/', $str); | |
$status = ($bool ? "<b>Good</b>" : "Bad"); | |
echo $status." : ".$str."\n"; | |
} | |
$kind = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- work, but the result not accurate | |
SELECT c.user_id, | |
c.user_fname, | |
COUNT(cc.user_id) AS total_child, | |
COUNT(ccc.user_id) AS total_consul | |
FROM drpp_user c | |
LEFT JOIN drpp_child cc | |
ON cc.user_id = c.user_id | |
LEFT JOIN drpp_consul ccc | |
ON ccc.user_id = c.user_id |
NewerOlder