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 . "`'"); } var_dump($lets);die(); $num = range(1, 26); $val = strtolower($val); $ret = preg_replace($lets, $num, $val); $ret = substr($ret, 0, 10); return $ret; } $b = getNumber($a); echo "<pre>"; var_dump($b);
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(26) { [0]=> string(5) "'`a`'" [1]=> string(5) "'`b`'" [2]=> string(5) "'`c`'" [3]=> string(5) "'`d`'" [4]=> string(5) "'`e`'" [5]=> string(5) "'`f`'" [6]=> string(5) "'`g`'" [7]=> string(5) "'`h`'" [8]=> string(5) "'`i`'" [9]=> string(5) "'`j`'" [10]=> string(5) "'`k`'" [11]=> string(5) "'`l`'" [12]=> string(5) "'`m`'" [13]=> string(5) "'`n`'" [14]=> string(5) "'`o`'" [15]=> string(5) "'`p`'" [16]=> string(5) "'`q`'" [17]=> string(5) "'`r`'" [18]=> string(5) "'`s`'" [19]=> string(5) "'`t`'" [20]=> string(5) "'`u`'" [21]=> string(5) "'`v`'" [22]=> string(5) "'`w`'" [23]=> string(5) "'`x`'" [24]=> string(5) "'`y`'" [25]=> string(5) "'`z`'" }
Output for 4.3.0 - 4.4.9
Warning: uniqid() expects at least 1 parameter, 0 given in /in/7CHaL on line 2 array(26) { [0]=> string(5) "'`a`'" [1]=> string(5) "'`b`'" [2]=> string(5) "'`c`'" [3]=> string(5) "'`d`'" [4]=> string(5) "'`e`'" [5]=> string(5) "'`f`'" [6]=> string(5) "'`g`'" [7]=> string(5) "'`h`'" [8]=> string(5) "'`i`'" [9]=> string(5) "'`j`'" [10]=> string(5) "'`k`'" [11]=> string(5) "'`l`'" [12]=> string(5) "'`m`'" [13]=> string(5) "'`n`'" [14]=> string(5) "'`o`'" [15]=> string(5) "'`p`'" [16]=> string(5) "'`q`'" [17]=> string(5) "'`r`'" [18]=> string(5) "'`s`'" [19]=> string(5) "'`t`'" [20]=> string(5) "'`u`'" [21]=> string(5) "'`v`'" [22]=> string(5) "'`w`'" [23]=> string(5) "'`x`'" [24]=> string(5) "'`y`'" [25]=> string(5) "'`z`'" }