3v4l.org

run code in 300+ PHP versions simultaneously
<?php $packed = '{"nonce":"xobK27GhMR960tSTcg5nrFSy35uwkKYn","key":"px2BaIAx17vdBQFdnLBimERK6KHqHNxhJN0PzKfhMHE","secretbox":"RFgczAJ_L0hOpIb_O0k9dFE58Cz-dagdEA3aHxUq_Q6jCEzTdzlMQyI7jEoauWOlH7m3EEXv4OFiD-Ke3otsoLJV0TPFbV2HV59pGNsSux9e"}'; $decoded = json_decode($packed, true); function base64url_decode(string $str): string { return base64_decode(strtr($str, '-_', '+/')); } $nonce = base64url_decode($decoded['nonce']); $key = base64url_decode($decoded['key']); $secretbox = base64url_decode($decoded['secretbox']); var_dump(sodium_crypto_secretbox_open($secretbox, $nonce, $key));
based on TpDP8
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 8.0.0
Fatal error: Uncaught Error: Call to undefined function sodium_crypto_secretbox_open() in /in/OODYk:14 Stack trace: #0 {main} thrown in /in/OODYk on line 14
Process exited with code 255.
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.25, 7.4.0 - 7.4.13
string(65) "don't mind me, just a feline getting comfy in this secretbox 🐱"
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Parse error: syntax error, unexpected ':', expecting '{' in /in/OODYk on line 6
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected ':', expecting '{' in /in/OODYk on line 6
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting ')' in /in/OODYk on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting ')' in /in/OODYk on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/OODYk on line 6
Process exited with code 255.