3v4l.org

run code in 150+ 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.2.17, 5.3.17, 5.3.23, 5.3.29, 5.4.1, 5.4.7, 5.4.15 - 5.4.21, 5.4.23 - 5.4.30, 5.4.32 - 5.4.38, 5.4.40, 5.4.42 - 5.4.43, 5.4.45 - 5.5.4, 5.5.6 - 5.5.9, 5.5.11 - 5.5.12, 5.5.14 - 5.5.20, 5.5.22, 5.5.27, 5.5.30 - 5.5.32, 5.5.37 - 5.5.38, 5.6.1, 5.6.5 - 5.6.11, 5.6.14 - 5.6.28, 7.0.0 - 7.0.13, 7.1.0
<pre>string(10) "51b99baa01"
Output for 5.0.0 - 5.2.16, 5.3.0 - 5.3.16, 5.3.18 - 5.3.22, 5.3.24 - 5.3.28, 5.4.0, 5.4.2 - 5.4.6, 5.4.8 - 5.4.13, 5.4.22, 5.4.39, 5.5.5, 5.5.10, 5.5.13, 5.5.23, 5.5.25, 5.5.33 - 5.5.36, 7.0.14
<pre>string(10) "51b99baa00"
Output for hhvm-3.13.2
<pre>string(10) "51b99baa15"
Output for hhvm-3.12.0
<pre>string(10) "51b99baaff"
Output for hhvm-3.10.0
<pre>string(10) "51b99baa4c"
Output for 5.6.3, 5.6.13
<pre>string(10) "51b99baa04"
Output for 5.4.14, 5.4.31, 5.4.44, 5.5.21, 5.5.28, 5.6.0, 5.6.4, 5.6.12
<pre>string(10) "51b99baa02"
Output for 5.4.41, 5.5.24, 5.5.26, 5.6.2
<pre>string(10) "51b99baa03"
Output for 5.5.29
<pre>string(10) "51b99baa05"
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)