3v4l.org

run code in 300+ PHP versions simultaneously
<?php function base64_encode_url($string) { return str_replace(['+','/','='], ['-','_',''], base64_encode($string)); } function base64_decode_url($string) { return base64_decode(str_replace(['-','_'], ['+','/'], $string)); } for ($i=0; $i<20000; $i++) { $data = random_bytes(rand(12,20)); if (base64_decode_url(base64_encode($data)) !== $data) { echo "FAIL"; } } echo "OK" . base64_encode_url();
Output for 7.3.0 - 7.3.29, 7.4.0 - 7.4.21, 8.0.0 - 8.0.8
Fatal error: Uncaught ArgumentCountError: Too few arguments to function base64_encode_url(), 0 passed in /in/M5UTq on line 18 and exactly 1 expected in /in/M5UTq:3 Stack trace: #0 /in/M5UTq(18): base64_encode_url() #1 {main} thrown in /in/M5UTq on line 3
Process exited with code 255.

preferences:
72.75 ms | 402 KiB | 64 Q