Home  >  Article  >  Backend Development  >  JS代码转成PHP代码,该如何处理

JS代码转成PHP代码,该如何处理

WBOY
WBOYOriginal
2016-06-13 12:37:01832browse

JS代码转成PHP代码

<script type="text/javascript"><br />
function rightSide(playerID) {<br />
    this.Decrypt2 = function(data) {<br />
        var b = (7 * (data - 6) % 10 + 10) % 10;<br />
        return b.toString();<br />
		alert(b.toString());<br />
    }<br />
<br />
    this.Decrypt = function(playerID) {<br />
        playerID = playerID.toString();<br />
        var arrID = new Array();<br />
        for (var i = 0; i < playerID.length; i = i + 1) {<br />
            var a = playerID.substr(i, 1);<br />
<br />
            switch (a) {<br />
                case "0": arrID.push(this.Decrypt2(0)); break;<br />
                case "4": arrID.push(this.Decrypt2(1)); break;<br />
                case "5": arrID.push(this.Decrypt2(2)); break;<br />
                case "3": arrID.push(this.Decrypt2(3)); break;<br />
                case "6": arrID.push(this.Decrypt2(4)); break;<br />
                case "9": arrID.push(this.Decrypt2(5)); break;<br />
                case "7": arrID.push(this.Decrypt2(6)); break;<br />
                case "1": arrID.push(this.Decrypt2(7)); break;<br />
                case "2": arrID.push(this.Decrypt2(8)); break;<br />
                case "8": arrID.push(this.Decrypt2(9)); break;<br />
            }<br />
        }<br />
        return arrID.join('');<br />
    }<br />
	return this.Decrypt(playerID);<br />
}	<br />
var idArr = rightSide(5705);


以上JS代码,帮忙转成PHP代码,谢谢各位了!!!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn