3v4l.org

run code in 300+ PHP versions simultaneously
<?php function random_string($length = 26, $alphabet = 'abcdefghijklmnopqrstuvwxyz234567') { if ($length < 1) { throw new InvalidArgumentException('Length must be a positive integer'); } $str = ''; $alphamax = strlen($alphabet) - 1; if ($alphamax < 1) { throw new InvalidArgumentException('Invalid alphabet'); } for ($i = 0; $i < $length; ++$i) { $str .= $alphabet[random_int(0, $alphamax)]; } return $str; } var_dump( random_string(), random_string(128), random_string(52, '0123456789abcdef') );
Output for git.master
string(26) "iybkhh2dj43qyhfzoehlt4slyz" string(128) "u5henzouwtfeizawj4ai2ienznvjpeaumhw43dzo343jepkvfh4oynfirs3ijh4ezzn2ejmcx4shao557ncor7p4eybr3dc7jes6k4js3f5dos3pjarfx5xg5xppytqn" string(52) "d0e468c051815c370478a77c30d420e5e3974fd82018fe6c5f61"
Output for git.master_jit
string(26) "t3zrubta3ve7maiweu3gtaosjq" string(128) "veh63vtnekl6mnm2toisjdysysqlevfnzyjkam3zob5czpnvsfwnfmqmaftccm2ks2ibiw5ynh2mk4jkr24ejw6htsnkqusp7blnbxmf3rinzfpmshukly2nqc5ekdko" string(52) "d0664003b25e20b8d694b0f6cc8a3d7791cba64d2b008454c807"
Output for rfc.property-hooks
string(26) "6cijdhnv4tqf6kwigqbhahsvxt" string(128) "m4mj6addmcmxaj7eydpnk6bap7wp5jx43m5mk2wcksxqlk6wbirjtymmmruweuqoafzvon2yl6jvvznq333hkr7x2evbpmzre2bdlpbk3nrocz25st5hztfezf36td7q" string(52) "65f7beb357bfb4533bef7e42b0de9d547f100d5f07c3bc968057"

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
33.45 ms | 401 KiB | 8 Q