3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = new \SimpleXMLElement(' <blog-post> <dc:tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <dc:tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <dc:tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <dc:tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <dc:tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <dc:tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> </blog-post>' ); $t = microtime(1); for ($i = 0; $i<100000; $i++){ count($xml->xpath('*')); } var_dump(microtime(1)-$t); $t = microtime(1); for ($i = 0; $i<100000; $i++){ $xml->count(); isset($xml->children()->tag); $xml->children()->tag; } var_dump(microtime(1)-$t);
based on W6iJY
Output for 7.3.0
float(0.25553798675537) float(0.079225063323975)
Output for 7.2.13
float(0.25360417366028) float(0.070729970932007)
Output for 7.2.12
float(0.25470495223999) float(0.066913843154907)
Output for 7.2.11
float(0.28228783607483) float(0.069723129272461)
Output for 7.2.10
float(0.23799800872803) float(0.06523609161377)
Output for 7.2.9
float(0.28833293914795) float(0.072190999984741)
Output for 7.2.8
float(0.27431893348694) float(0.082420110702515)
Output for 7.2.7
float(0.26295900344849) float(0.067836046218872)
Output for 7.2.6
float(0.25548386573792) float(0.065920114517212)
Output for 7.2.5
float(0.25496792793274) float(0.066097974777222)
Output for 7.2.4
float(0.25396180152893) float(0.067728996276855)
Output for 7.2.3
float(0.24664711952209) float(0.065654993057251)
Output for 7.2.2
float(0.26900100708008) float(0.072303056716919)
Output for 7.2.1
float(0.25921511650085) float(0.064369201660156)
Output for 7.2.0
float(0.26041984558105) float(0.064939975738525)
Output for 7.1.25
float(0.34077191352844) float(0.087203979492188)
Output for 7.1.24
float(0.32300114631653) float(0.080842971801758)
Output for 7.1.23
float(0.30622386932373) float(0.077682971954346)
Output for 7.1.22
float(0.30727910995483) float(0.075999021530151)
Output for 7.1.21
float(0.29141712188721) float(0.084537029266357)
Output for 7.1.20
float(0.33710813522339) float(0.076448917388916)
Output for 7.1.19
float(0.30215406417847) float(0.079545021057129)
Output for 7.1.18
float(0.29944491386414) float(0.094150066375732)
Output for 7.1.17
float(0.31598806381226) float(0.09148120880127)
Output for 7.1.16
float(0.3032488822937) float(0.080299139022827)
Output for 7.1.15
float(0.34639692306519) float(0.087447881698608)
Output for 7.1.14
float(0.33150911331177) float(0.082267999649048)
Output for 7.1.13
float(0.30704116821289) float(0.080479860305786)
Output for 7.1.12
float(0.32472014427185) float(0.085799217224121)
Output for 7.1.11
float(0.29671001434326) float(0.080766916275024)
Output for 7.1.10
float(0.33655881881714) float(0.084435939788818)
Output for 7.1.9
float(0.30104303359985) float(0.08134913444519)
Output for 7.1.8
float(0.31792712211609) float(0.081424951553345)
Output for 7.1.7
float(0.29830718040466) float(0.078891038894653)
Output for 7.1.6
float(0.30991005897522) float(0.081518888473511)
Output for 7.1.5
float(0.31082010269165) float(0.082716226577759)
Output for 7.1.4
float(0.29086899757385) float(0.079631090164185)
Output for 7.1.3
float(0.31613302230835) float(0.083704948425293)
Output for 7.1.2
float(0.31108999252319) float(0.076201915740967)
Output for 7.1.1
float(0.31593012809753) float(0.084062099456787)
Output for 7.1.0
float(0.3064169883728) float(0.080038070678711)
Output for 7.0.33
float(0.30903792381287) float(0.080940008163452)
Output for 7.0.32
float(0.30453586578369) float(0.07912015914917)
Output for 7.0.31
float(0.30893301963806) float(0.080528020858765)
Output for 7.0.30
float(0.3340630531311) float(0.090543031692505)
Output for 7.0.29
float(0.32168102264404) float(0.084224939346313)
Output for 7.0.28
float(0.28174209594727) float(0.080579996109009)
Output for 7.0.27
float(0.29869985580444) float(0.083362817764282)
Output for 7.0.26
float(0.32299113273621) float(0.085170030593872)
Output for 7.0.25
float(0.30804681777954) float(0.11797785758972)
Output for 7.0.24
float(0.32209897041321) float(0.088606834411621)
Output for 7.0.23
float(0.35210108757019) float(0.081489086151123)
Output for 7.0.22
float(0.31609487533569) float(0.085377931594849)
Output for 7.0.21
float(0.34309601783752) float(0.081272125244141)
Output for 7.0.20
float(0.29653716087341) float(0.082612037658691)
Output for 7.0.19
float(0.29039216041565) float(0.079231977462769)
Output for 7.0.18
float(0.33680200576782) float(0.086796045303345)
Output for 7.0.17
float(0.30176305770874) float(0.095906019210815)
Output for 7.0.16
float(0.30340719223022) float(0.082207918167114)
Output for 7.0.15
float(0.29124307632446) float(0.078034162521362)
Output for 7.0.14
float(0.3184130191803) float(0.080422878265381)
Output for 7.0.13
float(0.29576897621155) float(0.079190015792847)
Output for 7.0.12
float(0.28375911712646) float(0.077980041503906)
Output for 7.0.11
float(0.33163499832153) float(0.087777137756348)
Output for 7.0.10
float(0.30598998069763) float(0.079355001449585)
Output for 7.0.9
float(0.28695297241211) float(0.092664957046509)
Output for 7.0.8
float(0.3026020526886) float(0.083683013916016)
Output for 7.0.7
float(0.29183506965637) float(0.079006195068359)
Output for 7.0.6
float(0.32464289665222) float(0.083158016204834)
Output for 7.0.5
float(0.29637408256531) float(0.088659048080444)
Output for 7.0.4
float(0.33595299720764) float(0.085391044616699)
Output for 7.0.3
float(0.2935779094696) float(0.084350824356079)
Output for 7.0.2
float(0.33309102058411) float(0.07712984085083)
Output for 7.0.1
float(0.33147692680359) float(0.082003116607666)
Output for 7.0.0
float(0.29901480674744) float(0.082466125488281)
Output for 5.6.38
float(0.39132189750671) float(0.10721588134766)
Output for 5.6.37
float(0.3792610168457) float(0.10303020477295)
Output for 5.6.36
float(0.367506980896) float(0.097990989685059)
Output for 5.6.35
float(0.33464217185974) float(0.098540067672729)
Output for 5.6.34
float(0.35594177246094) float(0.10088515281677)
Output for 5.6.33
float(0.37637996673584) float(0.097901105880737)
Output for 5.6.32
float(0.38482999801636) float(0.098919868469238)
Output for 5.6.31
float(0.35442590713501) float(0.11694693565369)
Output for 5.6.30
float(0.3816339969635) float(0.11555218696594)
Output for 5.6.29
float(0.3725848197937) float(0.097624063491821)
Output for 5.6.28
float(0.35919785499573) float(0.099159955978394)
Output for 5.6.27
float(0.33425498008728) float(0.10371899604797)
Output for 5.6.26
float(0.34303784370422) float(0.10023999214172)
Output for 5.6.25
float(0.35526704788208) float(0.099573135375977)
Output for 5.6.24
float(0.36035013198853) float(0.11912107467651)
Output for 5.6.23
float(0.40948700904846) float(0.10924386978149)
Output for 5.6.22
float(0.37594890594482) float(0.10442686080933)
Output for 5.6.21
float(0.44162821769714) float(0.12394094467163)
Output for 5.6.20
float(0.35021591186523) float(0.11070489883423)
Output for 5.6.19
float(0.35288214683533) float(0.1070511341095)
Output for 5.6.18
float(0.39029693603516) float(0.10741877555847)
Output for 5.6.17
float(0.38982510566711) float(0.099004030227661)
Output for 5.6.16
float(0.36715602874756) float(0.10006308555603)
Output for 5.6.15
float(0.38331198692322) float(0.10319399833679)
Output for 5.6.14
float(0.37446403503418) float(0.11381387710571)
Output for 5.6.13
float(0.38333201408386) float(0.13384795188904)
Output for 5.6.12
float(0.43594598770142) float(0.11770677566528)
Output for 5.6.11
float(0.35608100891113) float(0.10580396652222)
Output for 5.6.10
float(0.37686991691589) float(0.12946796417236)
Output for 5.6.9
float(0.38901495933533) float(0.10416507720947)
Output for 5.6.8
float(0.39827084541321) float(0.098335027694702)
Output for 5.6.7
float(0.38248896598816) float(0.097105026245117)
Output for 5.6.6
float(0.33651208877563) float(0.10045385360718)
Output for 5.6.5
float(0.34505319595337) float(0.10041499137878)
Output for 5.6.4
float(0.36164498329163) float(0.10108995437622)
Output for 5.6.3
float(0.38413906097412) float(0.10111999511719)
Output for 5.6.2
float(0.33724403381348) float(0.10025882720947)
Output for 5.6.1
float(0.34690999984741) float(0.097597122192383)
Output for 5.6.0
float(0.33760499954224) float(0.10073018074036)