tags:

views:

44

answers:

1

Basically I want to do a php loop that base64_encodes its self 5 times.

//For example i want to encode "test" which is "dGVzdA=="
then we encode "dGVzdA==" which is "ZEdWemRBPT0="
then encode "ZEdWemRBPT0=" which is "WkVkV2VtUkJQVDA9"

I can't figure out how to create a loop that modifies its self each time it runs.

// this is what i had

function enloop($dowork){
    for ($i=1; $i<=5; $i++)
    {
        return base64_encode($dowork);
    }
}
enloop($code);

THIS SCRIPT just repeats the encode 5 times, lets say your encodign the word test for example the output would be dGVzdA==dGVzdA==dGVzdA==dGVzdA==dGVzdA==

this is not what i want.

+5  A: 
function enloop($dowork)
{
    for ($i = 1; $i <= 5; $i++)
    {
        $dowork = base64_encode($dowork);
    }

    return $dowork;
}

enloop($code);
zerkms
Seriously "zerkms" thats all it was, a matter of putting return outside of the for loop, god, lol thanks man.
kr1zmo