3v4l.org

run code in 300+ PHP versions simultaneously
<?php $time = microtime(true); for ($i = 0; $i < 1000000; $i++) { preg_match('/^(http|https)?:?\/\//', 'https://stackoverflow.com/questions/20248666/in-this-case-which-is-better-in-matching-regular-expression-or-parse-url'); } echo number_format(microtime(true) - $time, 10), "\n"; $time = microtime(true); for ($i = 0; $i < 1000000; $i++) { strpos('https://stackoverflow.com/questions/20248666/in-this-case-which-is-better-in-matching-regular-expression-or-parse-url', 'https://') === 0 || strpos('https://stackoverflow.com/questions/20248666/in-this-case-which-is-better-in-matching-regular-expression-or-parse-url', 'http://') === 0 || strpos('https://stackoverflow.com/questions/20248666/in-this-case-which-is-better-in-matching-regular-expression-or-parse-url', '//'); } echo number_format(microtime(true) - $time, 10);
Output for 8.3.1
0.0715451241 0.0258171558
Output for 8.3.0
0.0616800785 0.0258469582
Output for 8.2.14
0.0478770733 0.0244879723
Output for 8.2.13
0.0412948132 0.0264110565
Output for 8.2.12
0.0724809170 0.0246078968
Output for 8.2.11
0.0516550541 0.0246350765
Output for 8.2.10
0.0741348267 0.0229980946
Output for 8.2.9
0.0423250198 0.0248141289
Output for 8.2.8
0.0423259735 0.0281918049
Output for 8.2.7
0.0418601036 0.0245599747
Output for 8.2.6
0.0727798939 0.0242400169
Output for 8.2.5
0.0541069508 0.0239629745
Output for 8.2.4
0.0593481064 0.0240600109
Output for 8.2.3
0.0411131382 0.0242011547
Output for 8.2.2
0.0412888527 0.0247111320
Output for 8.2.1
0.0423288345 0.0256760120
Output for 8.2.0
0.0819230080 0.0242719650
Output for 8.1.27
0.0607612133 0.0247309208
Output for 8.1.26
0.0416870117 0.0247540474
Output for 8.1.25
0.0591359138 0.0247809887
Output for 8.1.24
0.0664198399 0.0256111622
Output for 8.1.23
0.0426599979 0.0245189667
Output for 8.1.22
0.0428171158 0.0253560543
Output for 8.1.21
0.0609490871 0.0256910324
Output for 8.1.20
0.0426549911 0.0257611275
Output for 8.1.19
0.0414221287 0.0255930424
Output for 8.1.18
0.0630738735 0.0250430107
Output for 8.1.17
0.0557470322 0.0255708694
Output for 8.1.16
0.0414128304 0.0251221657
Output for 8.1.15
0.0695598125 0.0258910656
Output for 8.1.14
0.0419330597 0.0244979858
Output for 8.1.13
0.0410590172 0.0251080990
Output for 8.1.12
0.0744209290 0.0243020058
Output for 8.1.11
0.0667769909 0.0253298283
Output for 8.1.10
0.0818829536 0.0247509480
Output for 8.1.9
0.0417630672 0.0247919559
Output for 8.1.8
0.0828070641 0.0250470638
Output for 8.1.7
0.0592370033 0.0252878666
Output for 8.1.6
0.0415430069 0.0250809193
Output for 8.1.5
0.0417590141 0.0253760815
Output for 8.1.4
0.0418958664 0.0248150826
Output for 8.1.3
0.0807368755 0.0244848728
Output for 8.1.2
0.0562767982 0.0245258808
Output for 8.1.1
0.0424361229 0.0246589184
Output for 8.1.0
0.0619630814 0.0245549679

preferences:
46.16 ms | 465 KiB | 5 Q