PHP Modify the return of a loop over and over.

Posted by Joshua Anderson on Stack Overflow See other posts from Stack Overflow or by Joshua Anderson
Published on 2010-06-13T05:27:58Z Indexed on 2010/06/13 5:32 UTC
Read the original article Hit count: 294

Filed under:

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++)
    {
        returns base64_encode($dowork);
    }
}
enloop($code);

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

© Stack Overflow or respective owner

Related posts about php