3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php mt_srand(42); echo generateKey(); function generateKey() { return base64encode(randBuffer(48)); } function base64encode($buf) { return str_replace(array('+', '/', '='), array('-', '_', ''), base64_encode($buf)); } function randBuffer($n) { //try { // $buf = openssl_random_pseudo_bytes($n); //} catch (Exception $e) { $buf = ""; for ($i = 0; $i < $n; $i++) { $buf .= chr(mt_rand(0, 255)); } //} return $buf; }
Output for 7.1.0
ZrNcDmpHvBRmedLWSspXdGNnl4KVNAFX650lgb-7FKDLORX861gw2jr-qf_bu88O
Output for 5.2.1 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.0.14
ocvz0EU5Z2YnctnnDosjq5kkS6YF8Pi4K_A2_i4ALmBNYoYBbgVKhmJmI_W0B6PF
Output for 4.3.0 - 5.2.0
pT9j5dLHr9rS80G6KYaoCPC8Blupd8YQkwDXt5whYMUZHDvl4IfFGfG6_ODnIH43