3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $number_of_tests = 40000; $time_array = array(); $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; for($i = 0; $i < $number_of_tests; $i++){ $str = "http://www.example.com?test=test"; preg_replace('/\\?.*/', '', $str); } $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); $time_array[ (string) $totaltime ] = 'Regexp'; $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; for($i = 0; $i < $number_of_tests; $i++){ $str = "http://www.example.com?test=test"; $str = explode('?', $str); } $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); $time_array[ (string) $totaltime ] = 'Explode'; $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; for($i = 0; $i < $number_of_tests; $i++){ $str = "http://www.example.com?test=test"; $qPos = strpos($str, "?"); $url_without_query_string = substr($str, 0, $qPos); } $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); $time_array[ (string) $totaltime ] = 'Substr'; $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; for($i = 0; $i < $number_of_tests; $i++){ $str = "http://www.example.com?test=test"; $url_without_query_string = strtok($str, '?'); } $mtime = microtime(); $mtime = explode(" ",$mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = ($endtime - $starttime); $time_array[ (string) $totaltime ] = 'Strtok'; echo "<pre>"; print_r($time_array);
Output for 7.1.0
<pre>Array ( [0.011295080184937] => Regexp [0.0062599182128906] => Explode [0.0049748420715332] => Substr [0.0043768882751465] => Strtok )
Output for 7.0.14
<pre>Array ( [0.012421846389771] => Regexp [0.0072529315948486] => Explode [0.0057709217071533] => Substr [0.0049190521240234] => Strtok )
Output for 7.0.6
<pre>Array ( [0.01106595993042] => Regexp [0.0070581436157227] => Explode [0.0053122043609619] => Substr [0.0028519630432129] => Strtok )
Output for 7.0.5
<pre>Array ( [0.0095360279083252] => Regexp [0.006242036819458] => Explode [0.0051338672637939] => Substr [0.0027849674224854] => Strtok )
Output for 7.0.4
<pre>Array ( [0.010195970535278] => Regexp [0.0053999423980713] => Explode [0.0038800239562988] => Substr [0.0031659603118896] => Strtok )
Output for 7.0.3
<pre>Array ( [0.0090808868408203] => Regexp [0.0062241554260254] => Explode [0.0048789978027344] => Substr [0.0026919841766357] => Strtok )
Output for 7.0.2
<pre>Array ( [0.010192155838013] => Regexp [0.0069389343261719] => Explode [0.0055570602416992] => Substr [0.0030272006988525] => Strtok )
Output for 7.0.1
<pre>Array ( [0.0094680786132812] => Regexp [0.0063371658325195] => Explode [0.0051760673522949] => Substr [0.0029139518737793] => Strtok )
Output for 7.0.0
<pre>Array ( [0.014650106430054] => Regexp [0.0092699527740479] => Explode [0.0069761276245117] => Substr [0.0037550926208496] => Strtok )
Output for 5.6.28
<pre>Array ( [0.032624959945679] => Regexp [0.017725944519043] => Explode [0.018224000930786] => Substr [0.010768175125122] => Strtok )
Output for 5.6.21
<pre>Array ( [0.028167963027954] => Regexp [0.015918016433716] => Explode [0.014176845550537] => Substr [0.0084619522094727] => Strtok )
Output for 5.6.20
<pre>Array ( [0.029857873916626] => Regexp [0.01701283454895] => Explode [0.014808893203735] => Substr [0.0086798667907715] => Strtok )
Output for 5.6.19
<pre>Array ( [0.027364015579224] => Regexp [0.014620065689087] => Explode [0.013989925384521] => Substr [0.0088560581207275] => Strtok )
Output for 5.6.18
<pre>Array ( [0.023208856582642] => Regexp [0.013023138046265] => Explode [0.012310981750488] => Substr [0.0081799030303955] => Strtok )
Output for 5.6.17
<pre>Array ( [0.02118992805481] => Regexp [0.013041019439697] => Explode [0.012984991073608] => Substr [0.0076370239257812] => Strtok )
Output for 5.6.16
<pre>Array ( [0.020217895507812] => Regexp [0.01285195350647] => Explode [0.012731790542603] => Substr [0.0073549747467041] => Strtok )
Output for 5.6.15
<pre>Array ( [0.027395009994507] => Regexp [0.0154869556427] => Explode [0.012365818023682] => Substr [0.0076639652252197] => Strtok )
Output for 5.6.14
<pre>Array ( [0.028255939483643] => Regexp [0.016294956207275] => Explode [0.014570951461792] => Substr [0.0091049671173096] => Strtok )
Output for 5.6.13
<pre>Array ( [0.02658486366272] => Regexp [0.015568017959595] => Explode [0.014837980270386] => Substr [0.0078940391540527] => Strtok )
Output for 5.6.12
<pre>Array ( [0.021337985992432] => Regexp [0.013467073440552] => Explode [0.013386964797974] => Substr [0.0072770118713379] => Strtok )
Output for 5.6.11
<pre>Array ( [0.027662038803101] => Regexp [0.015838861465454] => Explode [0.01484203338623] => Substr [0.0082559585571289] => Strtok )
Output for 5.6.10
<pre>Array ( [0.030854940414429] => Regexp [0.01691198348999] => Explode [0.012890100479126] => Substr [0.0073151588439941] => Strtok )
Output for 5.6.9
<pre>Array ( [0.020647048950195] => Regexp [0.012652158737183] => Explode [0.012512922286987] => Substr [0.006939172744751] => Strtok )
Output for 5.6.8
<pre>Array ( [0.029583930969238] => Regexp [0.01650595664978] => Explode [0.02386999130249] => Substr [0.0092530250549316] => Strtok )
Output for 5.5.35
<pre>Array ( [0.027736902236938] => Regexp [0.016556978225708] => Explode [0.015482902526855] => Substr [0.008389949798584] => Strtok )
Output for 5.5.34
<pre>Array ( [0.031572103500366] => Regexp [0.018412828445435] => Explode [0.017244100570679] => Substr [0.0093109607696533] => Strtok )
Output for 5.5.33
<pre>Array ( [0.022002935409546] => Regexp [0.012957096099854] => Explode [0.011604070663452] => Substr [0.0082521438598633] => Strtok )
Output for 5.5.32
<pre>Array ( [0.026386976242065] => Regexp [0.016123056411743] => Explode [0.014414072036743] => Substr [0.0085840225219727] => Strtok )
Output for 5.5.31
<pre>Array ( [0.02667498588562] => Regexp [0.016125202178955] => Explode [0.015346050262451] => Substr [0.0084798336029053] => Strtok )
Output for 5.5.30
<pre>Array ( [0.031533002853394] => Regexp [0.018316030502319] => Explode [0.016024827957153] => Substr [0.0091660022735596] => Strtok )
Output for 5.5.29
<pre>Array ( [0.025202989578247] => Regexp [0.014732837677002] => Explode [0.01416015625] => Substr [0.0078010559082031] => Strtok )
Output for 5.5.28
<pre>Array ( [0.027889013290405] => Regexp [0.016933917999268] => Explode [0.016242980957031] => Substr [0.0083150863647461] => Strtok )
Output for 5.5.27
<pre>Array ( [0.023854970932007] => Regexp [0.014825105667114] => Explode [0.014100790023804] => Substr [0.0084900856018066] => Strtok )
Output for 5.5.26
<pre>Array ( [0.026305913925171] => Regexp [0.01591420173645] => Explode [0.014032125473022] => Substr [0.0081110000610352] => Strtok )
Output for 5.5.25
<pre>Array ( [0.030559062957764] => Regexp [0.017704963684082] => Explode [0.015564918518066] => Substr [0.0087540149688721] => Strtok )
Output for 5.5.24
<pre>Array ( [0.039313077926636] => Regexp [0.021499872207642] => Explode [0.01853609085083] => Substr [0.010027885437012] => Strtok )
Output for 5.4.45
<pre>Array ( [0.028105974197388] => Regexp [0.015251159667969] => Explode [0.01145601272583] => Substr [0.0092899799346924] => Strtok )
Output for 5.4.44
<pre>Array ( [0.019814968109131] => Regexp [0.011759042739868] => Explode [0.0099141597747803] => Substr [0.0074231624603271] => Strtok )
Output for 5.4.43
<pre>Array ( [0.029687881469727] => Regexp [0.018191814422607] => Explode [0.018842935562134] => Substr [0.011393070220947] => Strtok )
Output for 5.4.42
<pre>Array ( [0.029977083206177] => Regexp [0.017759084701538] => Explode [0.021469831466675] => Substr [0.014971971511841] => Strtok )
Output for 5.4.41
<pre>Array ( [0.034761905670166] => Regexp [0.018712043762207] => Explode [0.024869918823242] => Substr [0.01126503944397] => Strtok )
Output for 5.4.40
<pre>Array ( [0.034305095672607] => Regexp [0.017737150192261] => Explode [0.018613815307617] => Substr [0.011544942855835] => Strtok )
Output for 5.4.39
<pre>Array ( [0.031648874282837] => Regexp [0.019252061843872] => Explode [0.020273208618164] => Substr [0.012661933898926] => Strtok )
Output for 5.4.38
<pre>Array ( [0.053546190261841] => Regexp [0.022980928421021] => Explode [0.021277904510498] => Substr [0.015285968780518] => Strtok )
Output for 5.4.37
<pre>Array ( [0.030647993087769] => Regexp [0.016925096511841] => Explode [0.019162893295288] => Substr [0.011178970336914] => Strtok )
Output for 5.4.36
<pre>Array ( [0.030086994171143] => Regexp [0.016669988632202] => Explode [0.018640995025635] => Substr [0.010799884796143] => Strtok )
Output for 5.4.35
<pre>Array ( [0.028017997741699] => Regexp [0.016716957092285] => Explode [0.019857883453369] => Substr [0.012171030044556] => Strtok )
Output for 5.4.34
<pre>Array ( [0.029139995574951] => Regexp [0.017309904098511] => Explode [0.019047021865845] => Substr [0.012128114700317] => Strtok )
Output for 5.4.32
<pre>Array ( [0.020212173461914] => Regexp [0.013394117355347] => Explode [0.01338791847229] => Substr [0.0084941387176514] => Strtok )
Output for 5.4.31
<pre>Array ( [0.020015001296997] => Regexp [0.011908054351807] => Explode [0.01321005821228] => Substr [0.007850170135498] => Strtok )
Output for 5.4.30
<pre>Array ( [0.021111965179443] => Regexp [0.01233696937561] => Explode [0.014113187789917] => Substr [0.0089068412780762] => Strtok )
Output for 5.4.29
<pre>Array ( [0.021239995956421] => Regexp [0.013223886489868] => Explode [0.015920877456665] => Substr [0.0085909366607666] => Strtok )
Output for 5.4.28
<pre>Array ( [0.038444995880127] => Regexp [0.01256799697876] => Explode [0.014669179916382] => Substr [0.0086491107940674] => Strtok )
Output for 5.4.27
<pre>Array ( [0.02153491973877] => Regexp [0.013029098510742] => Explode [0.014771223068237] => Substr [0.01476001739502] => Strtok )
Output for 5.4.26
<pre>Array ( [0.02745795249939] => Regexp [0.014139175415039] => Explode [0.014936923980713] => Substr [0.0090169906616211] => Strtok )
Output for 5.4.25
<pre>Array ( [0.023555040359497] => Regexp [0.014145135879517] => Explode [0.015465974807739] => Substr [0.009209156036377] => Strtok )
Output for 5.4.24
<pre>Array ( [0.023048162460327] => Regexp [0.013667821884155] => Explode [0.014556884765625] => Substr [0.009530782699585] => Strtok )
Output for 5.4.23
<pre>Array ( [0.023179054260254] => Regexp [0.01309609413147] => Explode [0.014373064041138] => Substr [0.0091328620910645] => Strtok )
Output for 5.4.22
<pre>Array ( [0.023960828781128] => Regexp [0.013010025024414] => Explode [0.015520095825195] => Substr [0.0085539817810059] => Strtok )
Output for 5.4.21
<pre>Array ( [0.021152973175049] => Regexp [0.013191938400269] => Explode [0.015361070632935] => Substr [0.0086441040039062] => Strtok )
Output for 5.4.20
<pre>Array ( [0.021190166473389] => Regexp [0.013015031814575] => Explode [0.015293121337891] => Substr [0.0087261199951172] => Strtok )
Output for 5.4.19
<pre>Array ( [0.024204015731812] => Regexp [0.013723850250244] => Explode [0.016533851623535] => Substr [0.010112047195435] => Strtok )
Output for 5.4.18
<pre>Array ( [0.024192810058594] => Regexp [0.016427993774414] => Explode [0.015812158584595] => Substr [0.0097999572753906] => Strtok )
Output for 5.4.17
<pre>Array ( [0.035675048828125] => Regexp [0.026988983154297] => Explode [0.027902126312256] => Substr [0.012377023696899] => Strtok )
Output for 5.4.16
<pre>Array ( [0.048245906829834] => Regexp [0.025141000747681] => Explode [0.025333881378174] => Substr [0.015995025634766] => Strtok )
Output for 5.4.15
<pre>Array ( [0.033933162689209] => Regexp [0.014314889907837] => Explode [0.014034032821655] => Substr [0.0086450576782227] => Strtok )
Output for 5.4.14
<pre>Array ( [0.023398876190186] => Regexp [0.014087915420532] => Explode [0.014851093292236] => Substr [0.009335994720459] => Strtok )
Output for 5.4.13
<pre>Array ( [0.024837017059326] => Regexp [0.013054132461548] => Explode [0.021780014038086] => Substr [0.018124103546143] => Strtok )
Output for 5.4.12
<pre>Array ( [0.024425983428955] => Regexp [0.013843059539795] => Explode [0.013848066329956] => Substr [0.0088629722595215] => Strtok )
Output for 5.4.11
<pre>Array ( [0.025835037231445] => Regexp [0.014168977737427] => Explode [0.015994071960449] => Substr [0.0096759796142578] => Strtok )
Output for 5.4.10
<pre>Array ( [0.022302865982056] => Regexp [0.013545036315918] => Explode [0.014322996139526] => Substr [0.0093550682067871] => Strtok )
Output for 5.4.9
<pre>Array ( [0.023621082305908] => Regexp [0.013601064682007] => Explode [0.015357971191406] => Substr [0.0090978145599365] => Strtok )
Output for 5.4.8
<pre>Array ( [0.022117137908936] => Regexp [0.01311206817627] => Explode [0.01358699798584] => Substr [0.0093021392822266] => Strtok )
Output for 5.4.7
<pre>Array ( [0.024351119995117] => Regexp [0.014778852462769] => Explode [0.01440691947937] => Substr [0.0090169906616211] => Strtok )
Output for 5.4.6
<pre>Array ( [0.025017023086548] => Regexp [0.016029834747314] => Explode [0.016010046005249] => Substr [0.009998083114624] => Strtok )
Output for 5.4.5
<pre>Array ( [0.038915872573853] => Regexp [0.018800973892212] => Explode [0.016440153121948] => Substr [0.0093870162963867] => Strtok )
Output for 5.4.4
<pre>Array ( [0.02451491355896] => Regexp [0.014065980911255] => Explode [0.014796018600464] => Substr [0.010411024093628] => Strtok )
Output for 5.4.3
<pre>Array ( [0.024555921554565] => Regexp [0.014458179473877] => Explode [0.015923976898193] => Substr [0.010538101196289] => Strtok )
Output for 5.4.2
<pre>Array ( [0.044977188110352] => Regexp [0.02504301071167] => Explode [0.02534008026123] => Substr [0.015905141830444] => Strtok )
Output for 5.4.1
<pre>Array ( [0.022103071212769] => Regexp [0.013242959976196] => Explode [0.014631986618042] => Substr [0.0096778869628906] => Strtok )
Output for 5.4.0
<pre>Array ( [0.022096872329712] => Regexp [0.013072967529297] => Explode [0.014577865600586] => Substr [0.0088860988616943] => Strtok )
Output for 5.3.29
<pre>Array ( [0.02354907989502] => Regexp [0.013892889022827] => Explode [0.016840934753418] => Substr [0.0097689628601074] => Strtok )
Output for 5.3.28
<pre>Array ( [0.024512052536011] => Regexp [0.014442920684814] => Explode [0.018902063369751] => Substr [0.0095369815826416] => Strtok )
Output for 5.3.27
<pre>Array ( [0.025982141494751] => Regexp [0.015166044235229] => Explode [0.017153978347778] => Substr [0.01018500328064] => Strtok )
Output for 5.3.26
<pre>Array ( [0.023607015609741] => Regexp [0.013999938964844] => Explode [0.0174560546875] => Substr [0.0098190307617188] => Strtok )
Output for 5.3.25
<pre>Array ( [0.023317098617554] => Regexp [0.015158891677856] => Explode [0.019447803497314] => Substr [0.010479927062988] => Strtok )
Output for 5.3.24
<pre>Array ( [0.025942087173462] => Regexp [0.017838001251221] => Explode [0.02090311050415] => Substr [0.020087957382202] => Strtok )
Output for 5.3.23
<pre>Array ( [0.056538105010986] => Regexp [0.016660928726196] => Explode [0.018597841262817] => Substr [0.011228084564209] => Strtok )
Output for 5.3.22
<pre>Array ( [0.03344988822937] => Regexp [0.016358852386475] => Explode [0.016969203948975] => Substr [0.01087212562561] => Strtok )
Output for 5.3.21
<pre>Array ( [0.026999950408936] => Regexp [0.016429901123047] => Explode [0.018110990524292] => Substr [0.011656045913696] => Strtok )
Output for 5.3.20
<pre>Array ( [0.044599056243896] => Regexp [0.01800012588501] => Explode [0.019351959228516] => Substr [0.011489868164062] => Strtok )
Output for 5.3.19
<pre>Array ( [0.029175996780396] => Regexp [0.02569317817688] => Explode [0.022665977478027] => Substr [0.014931917190552] => Strtok )
Output for 5.3.18
<pre>Array ( [0.051712036132812] => Regexp [0.034584045410156] => Explode [0.025506019592285] => Substr [0.013015031814575] => Strtok )
Output for 5.3.17
<pre>Array ( [0.027436971664429] => Regexp [0.014354944229126] => Explode [0.023580074310303] => Substr [0.021790027618408] => Strtok )
Output for 5.3.16
<pre>Array ( [0.057512998580933] => Regexp [0.032957077026367] => Explode [0.029019832611084] => Substr [0.018124103546143] => Strtok )
Output for 5.3.15
<pre>Array ( [0.052122831344604] => Regexp [0.023214101791382] => Explode [0.016156911849976] => Substr [0.0099937915802002] => Strtok )
Output for 5.3.14
<pre>Array ( [0.031893968582153] => Regexp [0.018520832061768] => Explode [0.018213033676147] => Substr [0.011147022247314] => Strtok )
Output for 5.3.13
<pre>Array ( [0.024325847625732] => Regexp [0.015177965164185] => Explode [0.01772403717041] => Substr [0.010710000991821] => Strtok )
Output for 5.3.12
<pre>Array ( [0.026512861251831] => Regexp [0.021171092987061] => Explode [0.01775598526001] => Substr [0.011237144470215] => Strtok )
Output for 5.3.11
<pre>Array ( [0.029880046844482] => Regexp [0.016379117965698] => Explode [0.020550012588501] => Substr [0.010964870452881] => Strtok )
Output for 5.3.10
<pre>Array ( [0.026371002197266] => Regexp [0.01506781578064] => Explode [0.018378973007202] => Substr [0.01042103767395] => Strtok )
Output for 5.3.9
<pre>Array ( [0.028176069259644] => Regexp [0.015321016311646] => Explode [0.017298221588135] => Substr [0.011695861816406] => Strtok )
Output for 5.3.8
<pre>Array ( [0.026547908782959] => Regexp [0.016924858093262] => Explode [0.017719984054565] => Substr [0.015774011611938] => Strtok )
Output for 5.3.7
<pre>Array ( [0.031728029251099] => Regexp [0.017349004745483] => Explode [0.018316030502319] => Substr [0.011532068252563] => Strtok )