
-----------------------------------
Amailer
Thu Jan 15, 2004 6:35 pm

replacing alphabets.
-----------------------------------
How would i do this?

a   b  c  d  e  f  g  h  i  j  k  l  m
|    |  |   |  |  |  |   |  | |   |  |  |
|    |  |   |  |  |  |   |  | |   |  |  |
|    |  |   |  |  |  |   |  | |   |  |  |
n    o p  q  r  s  t   u v w  x  y z


A = n
N = a

and so on.

so if i have this'

uryyb
it should display
hello

-----------------------------------
PaddyLong
Fri Jan 16, 2004 4:49 am


-----------------------------------
something like this should work... 




-----------------------------------
Amailer
Sat Jan 17, 2004 2:01 pm


-----------------------------------
errr nope.
upper() what's that?

also how can you do:
   $alphabit = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');

??

also, i tried soemthing like that...gave me the same result.
thing is that, if the word is
uryyb

the B don't get translated... cuz o = b :S

-----------------------------------
PaddyLong
Sat Jan 17, 2004 7:01 pm


-----------------------------------
k... this one works, I know what the problem with the old one was too (it would replace a character with something and then when it got to the character the original was replaced with in the array, it would put it back to the original)

upper () was supposed to be count () 


 


-----------------------------------
Amailer
Sat Jan 17, 2004 8:03 pm


-----------------------------------
woo, thanks.
Hmm how does this work really? lol

-----------------------------------
PaddyLong
Sun Jan 18, 2004 11:18 am


-----------------------------------
heh...
k so we have the alphabit array that stores all the characters to be replaced and then the encoding array that stores the characters to replace the ones in alphabit with (the character at index n of alphabit will be replaced with the character at index n of encoding)

then there is a for loop that looks at each character of the string that is being encoded.  for each of the letters it goes through the entire alphabit array to determine what index of alphabit the character of the string is.  when it finds the character in alphabit it adds to result the character from encoding that is at the index it found and sets replaced to 1 (to say that the character was found in alphabit).  if after it looks through the entire alphabit array, replaced is 0, it simply adds to result the original character.

-----------------------------------
wtd
Sat Feb 14, 2004 12:21 am


-----------------------------------
Ummm... this is actually really easy.  :-)



Feel free to hate me.   :wink:

-----------------------------------
Amailer
Sat Feb 14, 2004 12:31 am


-----------------------------------
there is no such function as str_rot13... hmm atleast not on my php (latest non beta version)

And you sure that function is ment to do what that script  PaddyLong made does??? lol weird.

-----------------------------------
wtd
Sat Feb 14, 2004 12:39 am


-----------------------------------
http://ca2.php.net/manual/en/function.str-rot13.php
