3v4l.org

run code in 300+ PHP versions simultaneously
<?php $telefones = [ '(11) 3333-4353', '(11) 98000-2222', '(11) 3027-5555', '(11) 97000-0333', '(12) 99999-9999', '(12) 88888-8888', '(13) 11111-1111' ]; $inicio = microtime(true); function sortNumber($a, $b) { $a = preg_replace('/\D/', '', $a); $b = preg_replace('/\D/', '', $b); return ($a > $b) ? -1 : 1; } for($i = 0; $i < 50000; $i++){ usort($telefones, 'sortNumber'); } echo 'Bruno Rigolon:' . (microtime(true) - $inicio) . "\n";
Output for 7.1.6
Bruno Rigolon:0.4195511341095
Output for 7.1.5
Bruno Rigolon:0.46018505096436
Output for 7.1.4
Bruno Rigolon:0.59971404075623
Output for 7.1.3
Bruno Rigolon:0.65090703964233
Output for 7.1.2
Bruno Rigolon:0.54166793823242
Output for 7.1.1
Bruno Rigolon:0.63427996635437
Output for 7.1.0
Bruno Rigolon:1.0620121955872
Output for 7.0.20
Bruno Rigolon:0.54632616043091
Output for 7.0.19
Bruno Rigolon:0.71596097946167
Output for 7.0.18
Bruno Rigolon:0.47180390357971
Output for 7.0.17
Bruno Rigolon:0.58090996742249
Output for 7.0.16
Bruno Rigolon:0.73752498626709
Output for 7.0.15
Bruno Rigolon:0.43225407600403
Output for 7.0.14
Bruno Rigolon:0.43247103691101
Output for 7.0.13
Bruno Rigolon:1.2729890346527
Output for 7.0.12
Bruno Rigolon:1.0268359184265
Output for 7.0.11
Bruno Rigolon:0.99577212333679
Output for 7.0.10
Bruno Rigolon:0.99021196365356
Output for 7.0.9
Bruno Rigolon:0.99893093109131
Output for 7.0.8
Bruno Rigolon:1.0253331661224
Output for 7.0.7
Bruno Rigolon:0.74167084693909
Output for 7.0.6
Bruno Rigolon:0.83195519447327
Output for 7.0.5
Bruno Rigolon:0.91143178939819
Output for 7.0.4
Bruno Rigolon:0.48861002922058
Output for 7.0.3
Bruno Rigolon:0.36033606529236
Output for 7.0.2
Bruno Rigolon:0.45703101158142
Output for 7.0.1
Bruno Rigolon:0.73649597167969
Output for 7.0.0
Bruno Rigolon:0.52686190605164