3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function gen_token() { $chars = array_merge(range("z","a"), range("Z", "A"), range("0", "9")); //Define the array length here so we dont have to call count() on each iteration $chars_len = count($chars)-1; $token_len = 25; $token = ""; for($i = 0; $i<$token_len; $i++) { $token .= $chars[mt_rand(0, $chars_len)]; } return $token;; } print strlen(gen_token()) == 25; ?>
based on hEgR4
Output for 4.3.0 - 7.1.7, 7.2.0
1
Output for 7.1.10

Process exited with code 137.