Self-written:
<? Php $ t1 = microtime (true); function SqlFormat ($ string) {$ Fstr = ''; $ strArr = explode (" _ ", $ string ); foreach ($ strArr AS $ key => $ val) {if ($ key! = 0) {$ Fstr. = ucfirst ($ val);} else {continue;} return (string) $ Fstr;} echo SqlFormat ('dede _ member_feed '); $ t2 = microtime (true ); echo ($ t2-$ t1) * 1000; // running Duration: 0.01 ~ 0.02?>
THINKPHP built-in:
<? Php $ t1 = microtime (true); function parse_name ($ name, $ type = 0) {if ($ type) {return ucfirst (preg_replace ("/_ ([a-zA-Z])/e", "strtoupper ('\ 1')", $ name ));} else {return strtolower (trim (preg_replace ("/[A-Z]/", "_ \ 0", $ name ),"_"));}} echo parse_name ('dede _ member_feed ', 1); $ t2 = microtime (true); echo ($ t2-$ t1) * 1000; // running Duration: 0.03 ~ 0.05?>
All of the above processes the string naming style;
This article from the "against the wind" blog, please be sure to keep this source http://windchaser.blog.51cto.com/5742634/1296502