3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _random(string $set , int $length): string { $setLength = strlen($set); $randomKey = random_int(0, $setLength - 1); $firstPiece = substr($set, 0, $randomKey); $secondPiece = substr($set, $randomKey, $setLength - $randomKey); $removedCharacter = $firstPiece[strlen($firstPiece) - 1] ?? null; if(null === $removedCharacter || $length === 0) { return ''; } $firstPieceWithoutTheLastChar = substr($firstPiece, 0, -1); return $removedCharacter . _random($firstPieceWithoutTheLastChar . $secondPiece, $length - 1); } $a = _random('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 32); $b = _random('abcdefghijklmnopqrstuvwxyz', 8); $c = _random('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 64); var_dump($a, $b, $c);
Output for git.master
string(32) "kQhEwqjLWxyVOfitopnPeINMSmbHgYrC" string(8) "iuerjapx" string(22) "GhoIglJWOHViSwPKvXeCda"

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:
38.64 ms | 405 KiB | 5 Q