Collect common PHP simple code to make a simple look at some of the functions sorted out in daily work :? 1. short chain generation algorithm functioncode62 ($ x) {$ show; while ($ x & gt; 0) {$ s $ x % 62; if ($ s & gt; 35) {$ schr ($ s + 61);} elseif ($ s & gt; 9 & a collect common PHP simple code
Make a simple look at some of the functions in daily work:
?
1. short chain generation algorithm
Function code62 ($ x) {$ show = ''; while ($ x> 0) {$ s = $ x % 62; if ($ s> 35) {$ s = chr ($ s + 61);} elseif ($ s> 9 & $ s <= 35) {$ s = chr ($ s + 55 );} $ show. = $ s; $ x = floor ($ x/62);} return $ show;} function compute url ($ url) {$ url = crc32 ($ url ); $ result = sprintf ("% u", $ url); // return $ url; // return $ result; return code62 ($ result );} br (shorturl ("http://pai.game.weibo.com/love/"); br (shorturl ("http://www.oschina.net/code/snippet_878945_22499 "));
?