3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = uniqid(); function getNumber($val) { $lets = array(); foreach (range('a', 'z') as $let) { $lets[] = ("'`" . $let . "`is'"); } $nums = array(); foreach (range(1, 26) as $num) { $nums[] = $num; } $val = strtolower($val); $ret = preg_replace($lets, $nums, $val); $ret = substr($ret, 0, 10); return $ret; } $b = getNumber($a); echo "<pre>"; var_dump($b);
Output for 5.4.41, 5.6.6, 5.6.16 - 5.6.17, 5.6.19, 5.6.25, 5.6.27, 7.0.2, 7.0.5, 7.0.10, 7.0.12 - 7.0.13, 7.0.17, 7.1.5 - 7.1.6, 7.2.0
<pre>string(10) "51b99baa01"
Output for 5.0.0 - 5.4.40, 5.4.42 - 5.6.5, 5.6.7 - 5.6.15, 5.6.18, 5.6.20 - 5.6.24, 5.6.26, 5.6.28 - 5.6.30, 7.0.0 - 7.0.1, 7.0.3 - 7.0.4, 7.0.6 - 7.0.7, 7.0.9, 7.0.11, 7.0.14, 7.0.16, 7.0.18 - 7.1.1, 7.1.7
<pre>string(10) "51b99baa00"
Output for 7.1.4
<pre>string(10) "51b99baa03"
Output for 7.1.3
<pre>string(10) "51b99baa06"
Output for 7.1.2
<pre>string(10) "51b99baa02"
Output for 7.0.15
<pre>string(10) "51b99baa0c"
Output for 7.0.8
<pre>string(10) "51b99baa0a"
Output for hhvm-3.17.3
<pre>string(10) "51b99bab42"
Output for hhvm-3.10.1, hhvm-3.12.14 - 3.15.4

Process exited with code 137.
Output for hhvm-3.11.1
<pre>string(10) "51b99bab06"
Output for 4.3.0 - 4.4.9
Warning: uniqid() expects at least 1 parameter, 0 given in /in/fjUcj on line 2 <pre>bool(false)