Help in Converting Small Python Code to PHP
<p>please i need some help in converting a python code to a php syntax 
the code is for generating an alphanumeric code using alpha encoding</p>

<p>the code :  </p>

<pre><code>def mkcpl(x):  
    x = ord(x)  
    set="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"  
    for c in set:  
        d = ord(c)^x  
        if chr(d) in set:  
            return 0,c,chr(d)  
        if chr(0xff^d) in set:  
            return 1,c,chr(0xff^d)  
    raise Exception,"No encoding found for %#02x"%x  


def mkalphadecryptloader(shcode):  
    s="hAAAAX5AAAAHPPPPPPPPa"  
    shcode=list(shcode)  
    shcode.reverse()  
    shcode = "".join(shcode)  
    shcode += "\x90"*((-len(shcode))%4)  
    for b in range(len(shcode)/4):  
        T,C,D = 0,"",""  
        for i in range(4):  
            t,c,d = mkcpl(shcode[4*b+i])  
            T += t &lt;&lt; i  
            C = c+C  
            D = d+D  
        s += "h%sX5%sP" % (C,D)  
        if T &gt; 0:  
            s += "TY"  
            T = (2*T^T)%16  
            for i in range(4):  
                if T &amp; 1:  
                    s += "19"  
                T &gt;&gt;= 1  
                if T == 0:  
                    break  
                s += "I"  
    return s+"\xff\xe4"  
</code></pre>

<p>any help would be really appreciated ...  </p>
