<?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;
}
$txt = xor_this('adeabecc');
echo xor_this('adeabecc');
- Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
- Fatal error: Array and string offset access syntax with curly braces is no longer supported in /in/3Ks4X on line 19
Process exited with code 255. - Output for 7.4.0 - 7.4.33
- Deprecated: Array and string offset access syntax with curly braces is deprecated in /in/3Ks4X on line 19
Deprecated: Array and string offset access syntax with curly braces is deprecated in /in/3Ks4X on line 19
Deprecated: Array and string offset access syntax with curly braces is deprecated in /in/3Ks4X on line 20
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 />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
- Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
- 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 />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
preferences:
246.93 ms | 403 KiB | 326 Q