3v4l.org

run code in 200+ php & hhvm versions
<?php function base64_encode_url($string) { $data = base64_encode($string); return str_replace(['+','/','='], ['-','_',''], $data); } function base64_decode_url($string) { $data = str_replace(['-','_'], ['+','/'], $string); $mod4 = strlen($data) % 4; return base64_decode($data /*. substr('====', $mod4)*/); } for ($i=0; $i<20000; $i++) { $data = random_bytes(rand(12,20)); if (base64_decode_url(base64_encode($data)) !== $data) { echo "FAIL"; } } echo "OK";
Output for hhvm-3.18.5 - 3.22.0, 7.0.28 - 7.3.0
OK
Output for 5.6.30 - 5.6.38
Fatal error: Call to undefined function random_bytes() in /in/9TR6J on line 15
Process exited with code 255.