Is there anyone of you who could help me a bit with this? I have a small method in C#, that I would like to convert to PHP. Unfortunately my knowledge of PHP is very limited. I'm hoping someone could give me some clues of how to do this. Just to say it, I am not looking for someone to do it for me, just help me get started.
This is the C# method.
private static string decode(string str1, string str2)
{
StringBuilder builder = new StringBuilder(str1);
StringBuilder builder2 = new StringBuilder(str2);
StringBuilder builder3 = new StringBuilder(str1.Length);
int num = 0;
Label_0084:
while (num < builder.Length)
{
int num2 = 0;
while (num2 < p1.Length)
{
if ((num == builder.Length) || (num2 == builder2.Length))
{
goto Label_0084;
}
char ch = builder[num];
char ch2 = builder2[num2];
ch = (char)(ch ^ ch2);
builder3.Append(ch);
num2++;
num++;
}
}
return builder3.ToString();
}
The two things I'm not at all sure about, and not even sure what to search for, is an equivialent of StringBuilder. Is there an equivialent? Or is it even needed? And then this part:
char ch = builder[num];
char ch2 = builder2[num2];
ch = (char)(ch ^ ch2);
builder3.Append(ch);
How would I replicate this in PHP?
Hope someone could help me shed some light over this. Best regards, /Rick