Christopher
April 20th, 2002, 17:37
I want to replace multiple things at once then print them out...
For example:
$Message = "Hello";
print str_replace("H","h",$Message);
I want the same effect, but to do like 50 str_replace's at a time... Any idea's?
Note: I don't want this script for changing case, above was just an example.
megapuzik
April 20th, 2002, 19:35
hmmm....
put all the txt in a var....and loop it !
$bla[0] = "yada";
$bla[1] = "fffff";
for($x=0;$x<=count($bla);$x++)
print str_replace("H","h",$bla[$x]);
something like this...
Christopher
April 20th, 2002, 22:20
No I don't think that would work....
See I have made one kinda what I want here (http://ugz.milescape.com/backwords.html), but I don't want the message to just be put backwards, I want it really encoded like A=N and K=W type thing..
So I kinda need like a function that prints lotta different str_replace's...
Christopher
April 21st, 2002, 12:36
Ok, does anyone know some other place I could ask?
megapuzik
April 21st, 2002, 13:26
I dont know whats wrong at what I gave you....
you want more str_replace ??
$bla[0] = "yada";
$bla[1] = "fffff";
for($x=0;$x<=count($bla);$x++){
$bla[$x] = str_replace("H","h",$bla[$x]);
$bla[$x] = str_replace("J","j",$bla[$x]);
$bla[$x] = str_replace("U","u",$bla[$x]);
print $bla[$x];
}
Christopher
April 21st, 2002, 15:22
Well, I did something like that except for the loop and the two bla's... Can someone make some sort of example that would fit my needs? All I need is kinda like a translation, like whenever the user types a F, replace it with a G, but I need tons of them... This is what I was trying....
$Text = $Encode;
$Text = str_replace("A","N",$Encode);
$Text = str_replace("B","R",$Encode);
$Text = str_replace("C","T",$Encode);
$Text = str_replace("D","J",$Encode);
$Text = str_replace("E","Z",$Encode);
$Text = str_replace("F","M",$Encode);
$Text = str_replace("G","S",$Encode);
$Text = str_replace("H","L",$Encode);
$Text = str_replace("I","X",$Encode);
$Text = str_replace("K","W",$Encode);
$Text = str_replace("Y","P",$Encode);
$Text = str_replace("O","Q",$Encode);
$Text = str_replace("U","V",$Encode);
$Text = str_replace("N","A",$Encode);
$Text = str_replace("R","B",$Encode);
$Text = str_replace("T","C",$Encode);
$Text = str_replace("J","D",$Encode);
$Text = str_replace("Z","E",$Encode);
$Text = str_replace("M","F",$Encode);
$Text = str_replace("S","G",$Encode);
$Text = str_replace("L","H",$Encode);
$Text = str_replace("X","I",$Encode);
$Text = str_replace("W","K",$Encode);
$Text = str_replace("P","Y",$Encode);
$Text = str_replace("Q","O",$Encode);
$Text = str_replace("V","U",$Encode);
$Text = str_replace("a","n",$Encode);
$Text = str_replace("b","r",$Encode);
$Text = str_replace("c","t",$Encode);
$Text = str_replace("d","j",$Encode);
$Text = str_replace("e","z",$Encode);
$Text = str_replace("f","m",$Encode);
$Text = str_replace("g","s",$Encode);
$Text = str_replace("h","l",$Encode);
$Text = str_replace("i","x",$Encode);
$Text = str_replace("k","w",$Encode);
$Text = str_replace("y","p",$Encode);
$Text = str_replace("o","q",$Encode);
$Text = str_replace("u","v",$Encode);
$Text = str_replace("n","a",$Encode);
$Text = str_replace("r","b",$Encode);
$Text = str_replace("t","c",$Encode);
$Text = str_replace("j","d",$Encode);
$Text = str_replace("z","e",$Encode);
$Text = str_replace("m","f",$Encode);
$Text = str_replace("s","g",$Encode);
$Text = str_replace("l","h",$Encode);
$Text = str_replace("x","i",$Encode);
$Text = str_replace("w","k",$Encode);
$Text = str_replace("p","y",$Encode);
$Text = str_replace("q","o",$Encode);
$Text = str_replace("v","u",$Encode);
print $Text;
Thank you all! Thanx megapuzik, if I am not doing ot right, please tell me :D
megapuzik
April 21st, 2002, 17:04
work on \ in your code(at the buttom)....
you have some parse errors
Christopher
April 21st, 2002, 17:12
I know, I was going to edit that but I decided not too... But the idea is still there :D
(I'll edit it now)
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.