I guess, there's a bug in the code, the correct one should be

Code: PHP
// Let's define our key here
 $key = 'G4E';
 
 // Our plaintext/ciphertext
 $text = 'Programming Forums';
 
 // Our output text
 $outText = '';
 
 // Iterate through each character
 for($i=0;$i<strlen($text);) // Dont need to increment here
 {
     for($j=0;$j<strlen($key);$j++,$i++)
     {
         $outText .= $text{$i} ^ $key{$j};
     }
 }