ooblik Posted January 2, 2008 Share Posted January 2, 2008 Well I've tried my hardest to debug this. I'm kind of a N00b. Please Help Me! My problem is: I am trying to take a name and parse all the characters to make them into random, look-alike, special characers. I don't get any errors but when I run my code the characters stay the same just all in uppercase... Basically it should convert: MyNickName to МψήίČκŇǻmΞ index.php ---------------------------------------------------------------------------------------- Main Function <?php function transNick($nick) { $nick=strtoupper($nick); for ($count=65; $count < 90; $count+=1) { $evaAln = "\$curarylen = count(\$" . chr($count) . ");"; eval($evaAln); srand((double)microtime() * 1000000); $randnum=(int)rand(1, $curarylen); $evaNch ="\$newchar = \$" . chr($count) . "[" . $randnum . "];"; eval($evaNch); str_replace(chr($count), $newchar, $nick); } return $nick; } echo transNick('Hello World!!'); The Arrays (Database of all special characters that look like normal characters ) $A=array ( "ª", "À", "Á", "Â", "Ã", "Ä", "Å", "à", "á", "â", "ã", "ä", "å", "Ā", "ā", "Ă", "ă", "Ą", "ą", "Ǎ", "ǎ", "Ǻ", "Ά", "α", "ά", "Д", "Л", "д", "∆", "/-\\" ); $B=array ( "ß", "β", "З", "Ъ", "Ь", "в", "б", "з", "ъ", "ь" ); $C=array ( "©", "¤", "Ç", "ç", "Ć", "ć", "Ĉ", "ĉ", "Ċ", "ċ", "Č", "č", "Є" ); $D=array ( "Ð", "ð", "ď", "Ď", "đ", "δ" ); $E=array ( "È", "É", "Ê", "Ë", "è", "é", "ê", "ë", "Ē", "Ĕ", "ĕ", "Ė", "ė", "Ę", "ę", "Ě", "ě", "Ə", "ə", "Έ", "Ξ", "Σ", "ε", "έ", "Ё", "Є", "Э", "ё", "є", "Ә", "ә", "Ẽ", "ẻ", "Ẻ", "ẹ", "Ẹ", "ẽ", "Ế", "ế", "Ề", "ề", "Ể", "ể", "Ễ", "ễ", "Ệ", "ệ", "℮", "€", "∑" ); $F=array ( "f", "Ғ", "ғ", "₣", "╒", "∫" ); $G=array ( "Ĝ", "ĝ", "Ğ", "ğ", "Ġ", "ġ", "Ģ", "ģ" ); $H=array ( "#", "Ĥ", "ĥ", "Ħ", "ħ", "λ", "Ђ", "Ћ", "И", "Й", "и", "й", "н ", "ђ", "ћ", "Ң", "ң", "Һ", "һ", "╫", "|-|" ); $I=array ( "¦", "¦", "Ì", "Í", "Î", "Ï", "ì", "í", "î", "ï", "Ĩ", "ĩ", "Ī", "ī", "Ĭ", "ĭ", "Į", "į", "İ", "ı", "ł", "Ǐ", "ǐ", "Ϊ", "ί", "ι", "", "і", "ї" ); $J=array ( "Ĵ", "ĵ", "Ј", "ј", "ل", "√" ); $K=array ( "Ķ", "ķ", "ĸ", "κ", "Ќ", "К", "к", "Қ", "қ", "Ҝ", "ҝ", "|<" ); $L=array ( "£", "Ĺ", "ĺ", "Ļ", "ļ", "Ľ", "ľ", "Ŀ", "ŀ", "Ł", "ł", "└", "|_" ); $M=array ( "М", "м", "|\/|" ); $N=array ( "Ñ", "ñ", "Ń", "ń", "Ņ", "ņ", "Ň", "ň", "ʼn", "Ŋ", "ŋ", "Π", "η", "ή", "Л", "П", "п", "₪", "ⁿ", "∩", "|\|" ); $O=array ( "°", "¤", "º", "Ò", "Ó", "Ô", "Õ", "Ö", "Ø", "ò", "ó", "ô", "õ", "ö", "ø", "Ō", "ō", "Ŏ", "ŏ", "Ő", "ő", "Ǒ", "ǒ", "ơ", "Ơ", "Ǿ", "ǿ", "˚", "Ό", "Ώ", "Θ", "Φ", "Ω", "θ", "ο", "σ", "φ", "ό", "Ф", "о", "Ө", "ө", "Ọ", "ọ", "Ỏ", "ỏ", "Ố", "ố", "Ồ", "ồ", "Ổ", "ổ", "Ỗ", "ỗ", "Ộ", "ộ", "Ớ", "ớ", "Ờ", "ờ", "Ở", "ở", "Ỡ", "ỡ", "Ợ", "ợ", "Ω", "○", "●", "◙", "◘", "◦", "☼" ); $P=array ( "¶", "ρ", "р" ); $Q=array ( "٩", "۹", "۶" ); $R=array ( "®", "Ŕ", "ŕ", "Ŗ", "ŗ", "Ř", "ř", "π", "я", "ѓ" ); $S=array ( "$", "§", "Ś", "ś", "Ŝ", "ŝ", "Ş", "ş", "ζ", "ς", "ξ", "ѕ" ); $T=array ( "+", "±", "Ţ", "ţ", "Ť", "ť", "Ŧ", "ŧ", "τ", "Ѓ", "Г", "Т", "т" ); $U=array ( "Ù", "Ú", "Û", "Ü", "ù", "ú", "û", "ü", "Ũ", "ũ", "Ū", "ū", "Ŭ", "ŭ", "Ů", "ů", "Ű", "ű", "Ų", "ų", "Ư", "ư", "Ǔ", "ǔ", "Ǖ", "ǖ", "Ǘ", "ǘ", "Ǚ", "ǚ", "Ǜ", "ǜ", "μ", "Ц", "ц", "џ", "Ụ", "ụ", "Ủ", "ủ", "Ứ", "ứ", "Ừ", "ừ", "Ử", "ử", "Ữ", "ữ", "Ự", "ự", "|_|" ); $V=array ( "ν", "υ", "ϋ", "ύ", "▼", "\/" ); $W=array ( "Ŵ", "ŵ", "ω", "ώ", "Ш", "Щ", "ш", "щ", "\/\/" ); $X=array ( "×", "Х", "х", "Ҳ", "ҳ", "><" ); $Y=array ( "¥", "Ý", "ý", "ÿ", "Ŷ", "ŷ", "Ύ", "Ϋ", "γ", "ψ", "Ў", "у", "ч", "ў", "Ү", "ү", "Ұ", "ұ", "Ỳ", "ỳ", "Ỵ", "ỵ", "Ỷ", "ỷ", "Ỹ", "ỹ" ); $Z=array ( "ح", "z", "Z" ); ?> Quote Link to comment https://forums.phpfreaks.com/topic/84086-tell-me-what-is-wrong-with-my-code/ Share on other sites More sharing options...
Daniel0 Posted January 2, 2008 Share Posted January 2, 2008 So you're having trouble posting the code here, or...? Quote Link to comment https://forums.phpfreaks.com/topic/84086-tell-me-what-is-wrong-with-my-code/#findComment-428005 Share on other sites More sharing options...
ooblik Posted January 2, 2008 Author Share Posted January 2, 2008 So you're having trouble posting the code here, or...? No I need someone to tell me what it wring with my code.... Its just when i post the code the arrays get messed up so ignore any errors with them. Quote Link to comment https://forums.phpfreaks.com/topic/84086-tell-me-what-is-wrong-with-my-code/#findComment-428007 Share on other sites More sharing options...
trq Posted January 2, 2008 Share Posted January 2, 2008 Well then, it would make it much easier if you'd describe your problem. Were not mind readers. Quote Link to comment https://forums.phpfreaks.com/topic/84086-tell-me-what-is-wrong-with-my-code/#findComment-428009 Share on other sites More sharing options...
rajivgonsalves Posted January 2, 2008 Share Posted January 2, 2008 hmm.. I tried using your code but it did not do anything... what exactly are you trying to achieve with this piece of code!.. Quote Link to comment https://forums.phpfreaks.com/topic/84086-tell-me-what-is-wrong-with-my-code/#findComment-428013 Share on other sites More sharing options...
ooblik Posted January 2, 2008 Author Share Posted January 2, 2008 hmm.. I tried using your code but it did not do anything... what exactly are you trying to achieve with this piece of code!.. Theres my problem..... haha but i described it above for you Quote Link to comment https://forums.phpfreaks.com/topic/84086-tell-me-what-is-wrong-with-my-code/#findComment-428014 Share on other sites More sharing options...
Daniel0 Posted January 2, 2008 Share Posted January 2, 2008 [...] but i described it above for you No you didn't. We need to know your expected result. Quote Link to comment https://forums.phpfreaks.com/topic/84086-tell-me-what-is-wrong-with-my-code/#findComment-428015 Share on other sites More sharing options...
ooblik Posted January 2, 2008 Author Share Posted January 2, 2008 [...] but i described it above for you No you didn't. We need to know your expected result. There I added what I wanted it to do. It should be clear now. If not just read the code! If a 15 yo noob can read it and know what it should do i think you can Quote Link to comment https://forums.phpfreaks.com/topic/84086-tell-me-what-is-wrong-with-my-code/#findComment-428019 Share on other sites More sharing options...
rajivgonsalves Posted January 2, 2008 Share Posted January 2, 2008 well here you go first of all, all those variables should be in an array passed to the function will make things easier I've used the easiest way out so don't me for bad coding just wanted you to get the idea, <?php $A=array ( "ª", "À", "Á", "Â", "Ã", "Ä", "Å", "à", "á", "â", "ã", "ä", "å", "Ā", "ā", "Ă", "ă", "Ą", "ą", "Ǎ", "ǎ", "Ǻ", "Ά", "α", "ά", "Д", "Л", "д", "∆", "/-\\" ); $B=array ( "ß", "β", "З", "Ъ", "Ь", "в", "б", "з", "ъ", "ь" ); $C=array ( "©", "¤", "Ç", "ç", "Ć", "ć", "Ĉ", "ĉ", "Ċ", "ċ", "Č", "č", "Є" ); $D=array ( "Ð", "ð", "ď", "Ď", "đ", "δ" ); $E=array ( "È", "É", "Ê", "Ë", "è", "é", "ê", "ë", "Ē", "Ĕ", "ĕ", "Ė", "ė", "Ę", "ę", "Ě", "ě", "Ə", "ə", "Έ", "Ξ", "Σ", "ε", "έ", "Ё", "Є", "Э", "ё", "є", "Ә", "ә", "Ẽ", "ẻ", "Ẻ", "ẹ", "Ẹ", "ẽ", "Ế", "ế", "Ề", "ề", "Ể", "ể", "Ễ", "ễ", "Ệ", "ệ", "℮", "€", "∑" ); $F=array ( "f", "Ғ", "ғ", "₣", "╒", "∫" ); $G=array ( "Ĝ", "ĝ", "Ğ", "ğ", "Ġ", "ġ", "Ģ", "ģ" ); $H=array ( "#", "Ĥ", "ĥ", "Ħ", "ħ", "λ", "Ђ", "Ћ", "И", "Й", "и", "й", "н ", "ђ", "ћ", "Ң", "ң", "Һ", "һ", "╫", "|-|" ); $I=array ( "¦", "¦", "Ì", "Í", "Î", "Ï", "ì", "í", "î", "ï", "Ĩ", "ĩ", "Ī", "ī", "Ĭ", "ĭ", "Į", "į", "İ", "ı", "ł", "Ǐ", "ǐ", "Ϊ", "ί", "ι", "", "і", "ї" ); $J=array ( "Ĵ", "ĵ", "Ј", "ј", "ل", "√" ); $K=array ( "Ķ", "ķ", "ĸ", "κ", "Ќ", "К", "к", "Қ", "қ", "Ҝ", "ҝ", "|<" ); $L=array ( "£", "Ĺ", "ĺ", "Ļ", "ļ", "Ľ", "ľ", "Ŀ", "ŀ", "Ł", "ł", "└", "|_" ); $M=array ( "М", "м", "|\/|" ); $N=array ( "Ñ", "ñ", "Ń", "ń", "Ņ", "ņ", "Ň", "ň", "ʼn", "Ŋ", "ŋ", "Π", "η", "ή", "Л", "П", "п", "₪", "ⁿ", "∩", "|\|" ); $O=array ( "°", "¤", "º", "Ò", "Ó", "Ô", "Õ", "Ö", "Ø", "ò", "ó", "ô", "õ", "ö", "ø", "Ō", "ō", "Ŏ", "ŏ", "Ő", "ő", "Ǒ", "ǒ", "ơ", "Ơ", "Ǿ", "ǿ", "˚", "Ό", "Ώ", "Θ", "Φ", "Ω", "θ", "ο", "σ", "φ", "ό", "Ф", "о", "Ө", "ө", "Ọ", "ọ", "Ỏ", "ỏ", "Ố", "ố", "Ồ", "ồ", "Ổ", "ổ", "Ỗ", "ỗ", "Ộ", "ộ", "Ớ", "ớ", "Ờ", "ờ", "Ở", "ở", "Ỡ", "ỡ", "Ợ", "ợ", "Ω", "○", "●", "◙", "◘", "◦", "☼" ); $P=array ( "¶", "ρ", "р" ); $Q=array ( "٩", "۹", "۶" ); $R=array ( "®", "Ŕ", "ŕ", "Ŗ", "ŗ", "Ř", "ř", "π", "я", "ѓ" ); $S=array ( "$", "§", "Ś", "ś", "Ŝ", "ŝ", "Ş", "ş", "ζ", "ς", "ξ", "ѕ" ); $T=array ( "+", "±", "Ţ", "ţ", "Ť", "ť", "Ŧ", "ŧ", "τ", "Ѓ", "Г", "Т", "т" ); $U=array ( "Ù", "Ú", "Û", "Ü", "ù", "ú", "û", "ü", "Ũ", "ũ", "Ū", "ū", "Ŭ", "ŭ", "Ů", "ů", "Ű", "ű", "Ų", "ų", "Ư", "ư", "Ǔ", "ǔ", "Ǖ", "ǖ", "Ǘ", "ǘ", "Ǚ", "ǚ", "Ǜ", "ǜ", "μ", "Ц", "ц", "џ", "Ụ", "ụ", "Ủ", "ủ", "Ứ", "ứ", "Ừ", "ừ", "Ử", "ử", "Ữ", "ữ", "Ự", "ự", "|_|" ); $V=array ( "ν", "υ", "ϋ", "ύ", "▼", "\/" ); $W=array ( "Ŵ", "ŵ", "ω", "ώ", "Ш", "Щ", "ш", "щ", "\/\/" ); $X=array ( "×", "Х", "х", "Ҳ", "ҳ", "><" ); $Y=array ( "¥", "Ý", "ý", "ÿ", "Ŷ", "ŷ", "Ύ", "Ϋ", "γ", "ψ", "Ў", "у", "ч", "ў", "Ү", "ү", "Ұ", "ұ", "Ỳ", "ỳ", "Ỵ", "ỵ", "Ỷ", "ỷ", "Ỹ", "ỹ" ); $Z=array ( "ح", "z", "Z" ); function transNick($nick) { $nick=strtoupper($nick); for ($count=65; $count < 90; $count++) { $char = $GLOBALS[chr($count)]; $evaAln = count($char); $randnum=(int)rand(1, $evaA1n); $evaNch =$char[$randnum]; $nick = str_replace(chr($count), $evaNch, $nick); } return $nick; } echo transNick('myNick'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/84086-tell-me-what-is-wrong-with-my-code/#findComment-428022 Share on other sites More sharing options...
ooblik Posted January 2, 2008 Author Share Posted January 2, 2008 I knew that i just wanted the important stuff up front so someone would take time to even try and fix it what you did worked except i want the new characters to be random!!! EDIT: NEVERMIND YOU JUST PUT a 1 instead if an L Thanks Alot!! Quote Link to comment https://forums.phpfreaks.com/topic/84086-tell-me-what-is-wrong-with-my-code/#findComment-428027 Share on other sites More sharing options...
rajivgonsalves Posted January 2, 2008 Share Posted January 2, 2008 Well I am trying to see whats wrong with da code Quote Link to comment https://forums.phpfreaks.com/topic/84086-tell-me-what-is-wrong-with-my-code/#findComment-428028 Share on other sites More sharing options...
rajivgonsalves Posted January 2, 2008 Share Posted January 2, 2008 well left out the unnecessary stuff here only the function function transNick($nick) { $nick=strtoupper($nick); for ($count=65; $count < 90; $count++) { $char = $GLOBALS[chr($count)]; $intCount = count($char); $randnum=rand(1, $intCount); $evaNch =$char[$randnum]; $nick = str_replace(chr($count), $evaNch, $nick); } return $nick; } hope its helpful Quote Link to comment https://forums.phpfreaks.com/topic/84086-tell-me-what-is-wrong-with-my-code/#findComment-428032 Share on other sites More sharing options...
rajivgonsalves Posted January 2, 2008 Share Posted January 2, 2008 just forgot one tiny thing out here is the function which will work perfectly function transNick($nick) { $nick=strtoupper($nick); for ($count=65; $count < 90; $count++) { $char = $GLOBALS[chr($count)]; $intCount = count($char); $randnum=rand(1, $intCount); $evaNch =$char[$randnum-1]; $nick = str_replace(chr($count), $evaNch, $nick); } return $nick; } hope its helpful to ya Quote Link to comment https://forums.phpfreaks.com/topic/84086-tell-me-what-is-wrong-with-my-code/#findComment-428035 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.