javascript - convert a JS function to PHP (math function) - no client base -
i need convert javascript calculusion functions php.
please help write 2 loops php
js: (a = 0; < 9; a++) z = z.replace(new regexp('\\' + ",-+@/. ;_".charat(a), 'g'), "ntj2m10ao".charat(a)); php: $st1 = ",-+@/. ;_"; $st2 = "ntj2m10ao"; for($a=0;$a<9;$a++){ z= preg_replace("\\$st1[$a]" ........ , $st2[$a],$z); }
and
js: var l = 128, o = (z.length) / 2, = ''; (a = ((k - 1) * l); < ((k) * l); a++) += string.fromcharcode(z.slice(a * 2, (a + 1) * 2)); php : .... ?
thanks helps pros
i solved myself
first loop :
$z="..........."; // string $st1=",-+@/. ;_"; $st2="ntj2m10ao"; for($a=0;$a<9;$a++) $z=str_replace($st1[$a], $st2[$a], $z);
second loop :
$l = 128; $o = (strlen($z)) / 2; $i = ''; ($a = (($k - 1) * $l); $a < ($k * $l); $a++) $i .= chr(substr($z,($a*2),2));
thanks @mawg , others
javascript php
No comments:
Post a Comment