tags:

views:

46

answers:

2
<?  
for ($i=0; $i<=9; $i++) {


    $b=urlencode($cl[1][$i]);
    $ara = array("http://anonymouse.org/cgi-bin/anon-www.cgi/", "http%3A%2F%2Fanonymouse.org%2Fcgi-bin%2Fanon-www.cgi%2F");
    $degis   = array("", "");
    $t = str_replace($ara, $degis, $b);
    $c="$t";
    $base64=base64_encode($t);


    $y=urldecode($t);
    $u=base64_encode($y);
    $qwe = "http://anonymouse.org/cgi-bin/anon-www.cgi/$y";
    $ewq = "h.php?y=$u";
    $bul = ($qwe);
    $degistir = ($ewq);
    $a =str_replace($bul, $degistir, $ic);
}
?>

when i put $cl[1][0], $cl[1][1], $cl[1][2] works successfull but when i put $i its returning null. why is this happening?

**I'm trying to change EACH url to base64 codes that I received from remote url with preg_match_all **

+2  A: 

Have you checked that $c1[1] has 10 elements? (From $c1[1][0] to $c1[1][9] there are 10 elements, not 9.

Maybe you are getting null for the last one $c1[1][9]. Try to do a var_dump($c1[1]) to check that it contains all the elements that you expect.

Update:

Change the this line

for ($i=0; $i<=9; $i++) {

into this

for ($i=0; $i<9; $i++) {
pakore
var_dump($cl[1]) returns array(9) is this the problem?
Ronnie Chester Lynwood
Yes. Your array contains 9 elements, but you are iterating over 10 elements, hence 1 is null. See my updated response.
pakore
when i use for ($i=0; $i<8; $i++) = $c1[1][8], ($i=0; $i<9; $i++) = $c1[1][8] not all changing only one.
Ronnie Chester Lynwood
lol i restarted php server and it worked:d
Ronnie Chester Lynwood
A: 

Try adding php after '?>' it worked for me.

Marware