3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php define('ALPHABET', 'acdegilmnoprstuw'); $hash = 680131659347; $string = 'leepadg'; echo sprintf('Hash of string «%s» is «%s».', $string, get_hash(ALPHABET, $string)), PHP_EOL , sprintf('String of hash «%s» is «%s».', $hash, unhash(ALPHABET, $hash)) ; function get_hash($alphabet, $string) { $h = 7; $len = strlen($string); for($i = 0; $i < $len; $i++) { $h = ($h * 37 + strpos($alphabet, $string[$i])); } return $h; } function unhash($alphabet, $hash) { $result = ''; $len = strlen($alphabet); while ($hash > 7) { for ($i = 0; $i < $len; $i++) { $newres = ($hash - $i) / 37; if (is_int($newres)) { $result .= $alphabet[$i]; $hash = $newres; break; } } } return strrev($result); }
based on Pljo3

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
Hash of string «leepadg» is «680131659347». String of hash «680131659347» is «leepadg».
Output for Arrow functions
Hash of string «leepadg» is «680131659347». String of hash «680131659347» is «leepadg».
Output for Object typehint
Hash of string «leepadg» is «680131659347». String of hash «680131659347» is «leepadg».
Output for Array change keys
Hash of string «leepadg» is «680131659347». String of hash «680131659347» is «leepadg».
Output for Lexical anon
Hash of string «leepadg» is «680131659347». String of hash «680131659347» is «leepadg».

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