3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xor_encrypt($in) { $key = '<censored>'; $text = $in; $outText = ''; // Iterate through each character for($i=0;$i<strlen($text);$i++) { $outText .= $text[$i] ^ $key[$i % strlen($key)]; } return $outText; } $my_data = array( "showpassword"=>"yes", "bgcolor"=>"#ffffff"); $my_data_e = xor_encrypt($my_data); $my_data_e = xor_encrypt($my_data_e); echo $my_data_e;
Output for 8.1.18 - 8.1.28, 8.2.5 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught TypeError: strlen(): Argument #1 ($string) must be of type string, array given in /in/0OH6e:9 Stack trace: #0 /in/0OH6e(19): xor_encrypt(Array) #1 {main} thrown in /in/0OH6e on line 9
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.17, 8.2.0 - 8.2.4
Fatal error: Uncaught TypeError: strlen(): Argument #1 ($str) must be of type string, array given in /in/0OH6e:9 Stack trace: #0 /in/0OH6e(19): xor_encrypt(Array) #1 {main} thrown in /in/0OH6e on line 9
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.17 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: strlen() expects parameter 1 to be string, array given in /in/0OH6e on line 9
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Notice: Array to string conversion in /in/0OH6e on line 9 Notice: Undefined offset: 0 in /in/0OH6e on line 10 Notice: Array to string conversion in /in/0OH6e on line 9 Notice: Undefined offset: 1 in /in/0OH6e on line 10 Notice: Array to string conversion in /in/0OH6e on line 9 Notice: Undefined offset: 2 in /in/0OH6e on line 10 Notice: Array to string conversion in /in/0OH6e on line 9 Notice: Undefined offset: 3 in /in/0OH6e on line 10 Notice: Array to string conversion in /in/0OH6e on line 9 Notice: Undefined offset: 4 in /in/0OH6e on line 10 Notice: Array to string conversion in /in/0OH6e on line 9 SU^C

preferences:
212.54 ms | 403 KiB | 340 Q