3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function xor_this($string) { // Let's define our key here $key = ('12341234'); // Our plaintext/ciphertext $text ='adeabecc'; // Our output text $outText = ''; // Iterate through each character for($i=0;$i<strlen($text);) { for($j=0;($j<strlen($key) && $i<strlen($text));$j++,$i++) { $outText .= $text{$i} ^ $key{$j}; echo 'i='.$i.', '.'j='.$j.', '.$outText{$i}.'<br />'; //for debugging } } return $outText; } echo xor_this('adeabecc');
based on 3Ks4X
Output for 5.3.19 - 7.2.0
i=0, j=0, P<br />i=1, j=1, V<br />i=2, j=2, V<br />i=3, j=3, U<br />i=4, j=4, S<br />i=5, j=5, W<br />i=6, j=6, P<br />i=7, j=7, W<br />PVVUSWPW