3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $attempts = 100000; $test = 1; if (true || $test == 1) { $start = microtime(true); for ($i = 0; $i < $attempts; $i++) { $user = array( 'id' => 27, 'name' => 'Pepe' ); } $end = microtime(true); echo 'Array: ' . ($end - $start) . " <br />\n"; } if (true || $test == 2) { $start = microtime(true); for ($i = 0; $i < $attempts; $i++) { $user = new stdClass(); $user->id = 27; $user->name = 'Pepe'; } $end = microtime(true); echo 'Object: ' . ($end - $start) . " <br />\n"; } if (true || $test == 3) { $start = microtime(true); for ($i = 0; $i < $attempts; $i++) { $user = (object) array( 'id' => 27, 'name' => 'Pepe' ); } $end = microtime(true); echo 'Cast: ' . ($end - $start) . " <br />\n"; }
Output for 7.1.0
Array: 0.0022029876708984 <br /> Object: 0.019996881484985 <br /> Cast: 0.008540153503418 <br />
Output for 7.0.14
Array: 0.010216951370239 <br /> Object: 0.022842168807983 <br /> Cast: 0.010749101638794 <br />
Output for 7.0.6
Array: 0.0071101188659668 <br /> Object: 0.016634941101074 <br /> Cast: 0.0078160762786865 <br />
Output for 7.0.5
Array: 0.006723165512085 <br /> Object: 0.015117168426514 <br /> Cast: 0.0068838596343994 <br />
Output for 7.0.4
Array: 0.0056049823760986 <br /> Object: 0.012870073318481 <br /> Cast: 0.0058839321136475 <br />
Output for 7.0.3
Array: 0.0062530040740967 <br /> Object: 0.015477895736694 <br /> Cast: 0.0068461894989014 <br />
Output for 7.0.2
Array: 0.0047640800476074 <br /> Object: 0.013046026229858 <br /> Cast: 0.0056309700012207 <br />
Output for 7.0.1
Array: 0.0044698715209961 <br /> Object: 0.011515140533447 <br /> Cast: 0.0053279399871826 <br />
Output for 7.0.0
Array: 0.0061650276184082 <br /> Object: 0.014522075653076 <br /> Cast: 0.0067658424377441 <br />
Output for hhvm-3.12.0
Array: 0.0045437812805176 <br /> Object: 0.031991958618164 <br /> Cast: 0.011839151382446 <br />
Output for hhvm-3.10.0
Array: 0.0058629512786865 <br /> Object: 0.035839080810547 <br /> Cast: 0.012819051742554 <br />
Output for 5.6.28
Array: 0.028462171554565 <br /> Object: 0.038156032562256 <br /> Cast: 0.028910875320435 <br />
Output for 5.6.21
Array: 0.017939805984497 <br /> Object: 0.028112888336182 <br /> Cast: 0.01812481880188 <br />
Output for 5.6.20
Array: 0.018744945526123 <br /> Object: 0.031653165817261 <br /> Cast: 0.021283149719238 <br />
Output for 5.6.19
Array: 0.012884140014648 <br /> Object: 0.024588823318481 <br /> Cast: 0.018052101135254 <br />
Output for 5.6.18
Array: 0.012411117553711 <br /> Object: 0.024137020111084 <br /> Cast: 0.018184900283813 <br />
Output for 5.6.17
Array: 0.017852067947388 <br /> Object: 0.031435012817383 <br /> Cast: 0.020416021347046 <br />
Output for 5.6.16
Array: 0.01309609413147 <br /> Object: 0.024471998214722 <br /> Cast: 0.017465114593506 <br />
Output for 5.6.15
Array: 0.018487215042114 <br /> Object: 0.031905889511108 <br /> Cast: 0.021532773971558 <br />
Output for 5.6.14
Array: 0.015982866287231 <br /> Object: 0.027578830718994 <br /> Cast: 0.019240140914917 <br />
Output for 5.6.13
Array: 0.012769937515259 <br /> Object: 0.023826837539673 <br /> Cast: 0.017765045166016 <br />
Output for 5.6.12
Array: 0.017831087112427 <br /> Object: 0.029065132141113 <br /> Cast: 0.018054008483887 <br />
Output for 5.6.11
Array: 0.017624139785767 <br /> Object: 0.030706882476807 <br /> Cast: 0.020559072494507 <br />
Output for 5.6.10
Array: 0.015314102172852 <br /> Object: 0.027184009552002 <br /> Cast: 0.018148899078369 <br />
Output for 5.6.9
Array: 0.018309116363525 <br /> Object: 0.031413078308105 <br /> Cast: 0.020517110824585 <br />
Output for 5.6.8
Array: 0.015214920043945 <br /> Object: 0.026279926300049 <br /> Cast: 0.018532991409302 <br />
Output for 5.5.35
Array: 0.015037059783936 <br /> Object: 0.025918960571289 <br /> Cast: 0.018564939498901 <br />
Output for 5.5.34
Array: 0.020689010620117 <br /> Object: 0.035243988037109 <br /> Cast: 0.022915124893188 <br />
Output for 5.5.33
Array: 0.016401052474976 <br /> Object: 0.030872106552124 <br /> Cast: 0.019772052764893 <br />
Output for 5.5.32
Array: 0.018082141876221 <br /> Object: 0.032483100891113 <br /> Cast: 0.020617961883545 <br />
Output for 5.5.31
Array: 0.016618967056274 <br /> Object: 0.030675172805786 <br /> Cast: 0.02018404006958 <br />
Output for 5.5.30
Array: 0.014309883117676 <br /> Object: 0.027726888656616 <br /> Cast: 0.020470142364502 <br />
Output for 5.5.29
Array: 0.016546010971069 <br /> Object: 0.029650926589966 <br /> Cast: 0.019750833511353 <br />
Output for 5.5.28
Array: 0.014592885971069 <br /> Object: 0.025997877120972 <br /> Cast: 0.018527030944824 <br />
Output for 5.5.27
Array: 0.014973878860474 <br /> Object: 0.028846979141235 <br /> Cast: 0.017950057983398 <br />
Output for 5.5.26
Array: 0.018549203872681 <br /> Object: 0.032963037490845 <br /> Cast: 0.021539211273193 <br />
Output for 5.5.25
Array: 0.01317286491394 <br /> Object: 0.02581787109375 <br /> Cast: 0.017836093902588 <br />
Output for 5.5.24
Array: 0.020859003067017 <br /> Object: 0.035356998443604 <br /> Cast: 0.020670890808105 <br />
Output for 5.4.45
Array: 0.027796983718872 <br /> Object: 0.045125961303711 <br /> Cast: 0.035186052322388 <br />
Output for 5.4.44
Array: 0.050215005874634 <br /> Object: 0.10119199752808 <br /> Cast: 0.031062126159668 <br />
Output for 5.4.43
Array: 0.012915849685669 <br /> Object: 0.090559005737305 <br /> Cast: 0.11545395851135 <br />
Output for 5.4.42
Array: 0.075163125991821 <br /> Object: 0.10383892059326 <br /> Cast: 0.050848007202148 <br />
Output for 5.4.41
Array: 0.064403057098389 <br /> Object: 0.10210609436035 <br /> Cast: 0.062143087387085 <br />
Output for 5.4.40
Array: 0.030136108398438 <br /> Object: 0.086859941482544 <br /> Cast: 0.10239005088806 <br />
Output for 5.4.39
Array: 0.082514047622681 <br /> Object: 0.14612889289856 <br /> Cast: 0.059348106384277 <br />
Output for 5.4.38
Array: 0.044028997421265 <br /> Object: 0.081961154937744 <br /> Cast: 0.048743009567261 <br />
Output for 5.4.37
Array: 0.035749197006226 <br /> Object: 0.069072008132935 <br /> Cast: 0.063004016876221 <br />
Output for 5.4.36
Array: 0.019858837127686 <br /> Object: 0.045170068740845 <br /> Cast: 0.027459144592285 <br />
Output for 5.4.35
Array: 0.034078121185303 <br /> Object: 0.09311318397522 <br /> Cast: 0.051111936569214 <br />
Output for 5.4.34
Array: 0.06502103805542 <br /> Object: 0.12745404243469 <br /> Cast: 0.044288873672485 <br />
Output for 5.4.32
Array: 0.014220952987671 <br /> Object: 0.029577970504761 <br /> Cast: 0.019734859466553 <br />
Output for 5.4.31
Array: 0.014172077178955 <br /> Object: 0.028958082199097 <br /> Cast: 0.019843101501465 <br />
Output for 5.4.30
Array: 0.030099868774414 <br /> Object: 0.040864229202271 <br /> Cast: 0.025023937225342 <br />
Output for 5.4.29
Array: 0.021559000015259 <br /> Object: 0.066527843475342 <br /> Cast: 0.022065162658691 <br />
Output for 5.4.28
Array: 0.018840074539185 <br /> Object: 0.054282188415527 <br /> Cast: 0.022181034088135 <br />
Output for 5.4.27
Array: 0.030843019485474 <br /> Object: 0.056771039962769 <br /> Cast: 0.038125991821289 <br />
Output for 5.4.26
Array: 0.029229879379272 <br /> Object: 0.050541877746582 <br /> Cast: 0.023004055023193 <br />
Output for 5.4.25
Array: 0.016195058822632 <br /> Object: 0.035737037658691 <br /> Cast: 0.029464960098267 <br />
Output for 5.4.24
Array: 0.018962860107422 <br /> Object: 0.035113096237183 <br /> Cast: 0.024618148803711 <br />
Output for 5.4.23
Array: 0.017184019088745 <br /> Object: 0.037341117858887 <br /> Cast: 0.026882171630859 <br />
Output for 5.4.22
Array: 0.03377890586853 <br /> Object: 0.06812596321106 <br /> Cast: 0.051251888275146 <br />
Output for 5.4.21
Array: 0.031316995620728 <br /> Object: 0.060508012771606 <br /> Cast: 0.041629076004028 <br />
Output for 5.4.20
Array: 0.032229900360107 <br /> Object: 0.061280965805054 <br /> Cast: 0.052572011947632 <br />
Output for 5.4.19
Array: 0.031760931015015 <br /> Object: 0.060020923614502 <br /> Cast: 0.04267406463623 <br />
Output for 5.4.18
Array: 0.031714200973511 <br /> Object: 0.060969114303589 <br /> Cast: 0.04251503944397 <br />
Output for 5.4.17
Array: 0.030730962753296 <br /> Object: 0.069730997085571 <br /> Cast: 0.053655862808228 <br />
Output for 5.4.16
Array: 0.030412912368774 <br /> Object: 0.059611797332764 <br /> Cast: 0.043092012405396 <br />
Output for 5.4.15
Array: 0.030687093734741 <br /> Object: 0.058383941650391 <br /> Cast: 0.050992012023926 <br />
Output for 5.4.14
Array: 0.029775142669678 <br /> Object: 0.058568000793457 <br /> Cast: 0.031239032745361 <br />
Output for 5.4.13
Array: 0.015356063842773 <br /> Object: 0.033123016357422 <br /> Cast: 0.024529933929443 <br />
Output for 5.4.12
Array: 0.016654014587402 <br /> Object: 0.035225868225098 <br /> Cast: 0.023677110671997 <br />
Output for 5.4.11
Array: 0.016110897064209 <br /> Object: 0.037760972976685 <br /> Cast: 0.023489952087402 <br />
Output for 5.4.10
Array: 0.017206192016602 <br /> Object: 0.036378145217896 <br /> Cast: 0.024325132369995 <br />
Output for 5.4.9
Array: 0.016566038131714 <br /> Object: 0.037831783294678 <br /> Cast: 0.027335166931152 <br />
Output for 5.4.8
Array: 0.021845102310181 <br /> Object: 0.041248083114624 <br /> Cast: 0.027029991149902 <br />
Output for 5.4.7
Array: 0.021578073501587 <br /> Object: 0.048474073410034 <br /> Cast: 0.029114007949829 <br />
Output for 5.4.6
Array: 0.019374132156372 <br /> Object: 0.04338002204895 <br /> Cast: 0.023545980453491 <br />
Output for 5.4.5
Array: 0.018969058990479 <br /> Object: 0.043042898178101 <br /> Cast: 0.027889966964722 <br />
Output for 5.4.4
Array: 0.01982593536377 <br /> Object: 0.040292978286743 <br /> Cast: 0.032511949539185 <br />
Output for 5.4.3
Array: 0.043820858001709 <br /> Object: 0.072866916656494 <br /> Cast: 0.044405937194824 <br />
Output for 5.4.2
Array: 0.029742002487183 <br /> Object: 0.063747882843018 <br /> Cast: 0.041501045227051 <br />
Output for 5.4.1
Array: 0.029664039611816 <br /> Object: 0.064380884170532 <br /> Cast: 0.041191101074219 <br />
Output for 5.4.0
Array: 0.036577939987183 <br /> Object: 0.078289985656738 <br /> Cast: 0.048216104507446 <br />
Output for 5.3.29
Array: 0.018069982528687 <br /> Object: 0.040011882781982 <br /> Cast: 0.021931886672974 <br />
Output for 5.3.28
Array: 0.020798921585083 <br /> Object: 0.091916084289551 <br /> Cast: 0.031475067138672 <br />
Output for 5.3.27
Array: 0.035056829452515 <br /> Object: 0.072921991348267 <br /> Cast: 0.045264005661011 <br />
Output for 5.3.26
Array: 0.035665988922119 <br /> Object: 0.079665899276733 <br /> Cast: 0.048956155776978 <br />
Output for 5.3.25
Array: 0.048793077468872 <br /> Object: 0.12963318824768 <br /> Cast: 0.06232213973999 <br />
Output for 5.3.24
Array: 0.04218602180481 <br /> Object: 0.08042311668396 <br /> Cast: 0.049769163131714 <br />
Output for 5.3.23
Array: 0.035857915878296 <br /> Object: 0.072885990142822 <br /> Cast: 0.035087108612061 <br />
Output for 5.3.22
Array: 0.020435810089111 <br /> Object: 0.041300773620605 <br /> Cast: 0.0262770652771 <br />
Output for 5.3.21
Array: 0.022373914718628 <br /> Object: 0.054708003997803 <br /> Cast: 0.02830696105957 <br />
Output for 5.3.20
Array: 0.022538900375366 <br /> Object: 0.043426036834717 <br /> Cast: 0.026141881942749 <br />
Output for 5.3.19
Array: 0.021794080734253 <br /> Object: 0.052769899368286 <br /> Cast: 0.030249118804932 <br />
Output for 5.3.18
Array: 0.021229982376099 <br /> Object: 0.056340932846069 <br /> Cast: 0.035352945327759 <br />
Output for 5.3.17
Array: 0.026209831237793 <br /> Object: 0.059902191162109 <br /> Cast: 0.038105964660645 <br />
Output for 5.3.16
Array: 0.021458148956299 <br /> Object: 0.063390970230103 <br /> Cast: 0.051163911819458 <br />
Output for 5.3.15
Array: 0.034187793731689 <br /> Object: 0.078551054000854 <br /> Cast: 0.042106866836548 <br />
Output for 5.3.14
Array: 0.034039974212646 <br /> Object: 0.07171106338501 <br /> Cast: 0.029283046722412 <br />
Output for 5.3.13
Array: 0.025646209716797 <br /> Object: 0.085032939910889 <br /> Cast: 0.028087854385376 <br />
Output for 5.3.12
Array: 0.027439117431641 <br /> Object: 0.056156158447266 <br /> Cast: 0.031378984451294 <br />
Output for 5.3.11
Array: 0.033284902572632 <br /> Object: 0.05364203453064 <br /> Cast: 0.037487983703613 <br />
Output for 5.3.10
Array: 0.047106981277466 <br /> Object: 0.076889991760254 <br /> Cast: 0.041711807250977 <br />
Output for 5.3.9
Array: 0.03214693069458 <br /> Object: 0.070752859115601 <br /> Cast: 0.042268037796021 <br />
Output for 5.3.8
Array: 0.035619974136353 <br /> Object: 0.098878145217896 <br /> Cast: 0.045297145843506 <br />
Output for 5.3.7
Array: 0.019830942153931 <br /> Object: 0.064702033996582 <br /> Cast: 0.025290012359619 <br />
Output for 5.3.6
Array: 0.026831865310669 <br /> Object: 0.065440893173218 <br /> Cast: 0.037664890289307 <br />
Output for 5.3.5
Array: 0.026530027389526 <br /> Object: 0.055483102798462 <br /> Cast: 0.027972936630249 <br />
Output for 5.3.4
Array: 0.021404981613159 <br /> Object: 0.056967973709106 <br /> Cast: 0.05214786529541 <br />
Output for 5.3.3
Array: 0.036195039749146 <br /> Object: 0.10741305351257 <br /> Cast: 0.046900033950806 <br />
Output for 5.3.2
Array: 0.034749031066895 <br /> Object: 0.073078155517578 <br /> Cast: 0.046092987060547 <br />
Output for 5.3.1
Array: 0.035148143768311 <br /> Object: 0.075889825820923 <br /> Cast: 0.052747011184692 <br />
Output for 5.3.0
Array: 0.043973922729492 <br /> Object: 0.073670148849487 <br /> Cast: 0.046916007995605 <br />
Output for 5.2.17
Array: 0.043245077133179 <br /> Object: 0.092883110046387 <br /> Cast: 0.05460786819458 <br />
Output for 5.2.16
Array: 0.04420804977417 <br /> Object: 0.099553108215332 <br /> Cast: 0.056429147720337 <br />
Output for 5.2.15
Array: 0.045039892196655 <br /> Object: 0.093250036239624 <br /> Cast: 0.037435054779053 <br />
Output for 5.2.14
Array: 0.025561094284058 <br /> Object: 0.048933982849121 <br /> Cast: 0.030725002288818 <br />
Output for 5.2.13
Array: 0.024029970169067 <br /> Object: 0.04602313041687 <br /> Cast: 0.029865026473999 <br />
Output for 5.2.12
Array: 0.023308038711548 <br /> Object: 0.057610034942627 <br /> Cast: 0.031278133392334 <br />
Output for 5.2.11
Array: 0.036273002624512 <br /> Object: 0.058846950531006 <br /> Cast: 0.0280601978302 <br />
Output for 5.2.10
Array: 0.024697065353394 <br /> Object: 0.063770055770874 <br /> Cast: 0.05110502243042 <br />
Output for 5.2.9
Array: 0.039618968963623 <br /> Object: 0.049744129180908 <br /> Cast: 0.032402992248535 <br />
Output for 5.2.8
Array: 0.025331020355225 <br /> Object: 0.050063133239746 <br /> Cast: 0.034011125564575 <br />
Output for 5.2.7
Array: 0.024971008300781 <br /> Object: 0.06573486328125 <br /> Cast: 0.054693937301636 <br />
Output for 5.2.6
Array: 0.030978202819824 <br /> Object: 0.048611879348755 <br /> Cast: 0.032293081283569 <br />
Output for 5.2.5
Array: 0.052824974060059 <br /> Object: 0.077189922332764 <br /> Cast: 0.035524129867554 <br />
Output for 5.2.4
Array: 0.03583812713623 <br /> Object: 0.054298162460327 <br /> Cast: 0.03718113899231 <br />
Output for 5.2.3
Array: 0.040559053421021 <br /> Object: 0.077304124832153 <br /> Cast: 0.050951957702637 <br />
Output for 5.2.2
Array: 0.042695999145508 <br /> Object: 0.077785015106201 <br /> Cast: 0.060012817382812 <br />
Output for 5.2.1
Array: 0.029557228088379 <br /> Object: 0.058738946914673 <br /> Cast: 0.034546136856079 <br />
Output for 5.2.0
Array: 0.033688068389893 <br /> Object: 0.070383787155151 <br /> Cast: 0.053598880767822 <br />
Output for 5.1.6
Array: 0.025177955627441 <br /> Object: 0.060314893722534 <br /> Cast: 0.058267116546631 <br />
Output for 5.1.5
Array: 0.035424947738647 <br /> Object: 0.076866149902344 <br /> Cast: 0.029783010482788 <br />
Output for 5.1.4
Array: 0.022531986236572 <br /> Object: 0.045838832855225 <br /> Cast: 0.030922889709473 <br />
Output for 5.1.3
Array: 0.02454686164856 <br /> Object: 0.046274185180664 <br /> Cast: 0.032537937164307 <br />
Output for 5.1.2
Array: 0.019902944564819 <br /> Object: 0.041100025177002 <br /> Cast: 0.023625135421753 <br />
Output for 5.1.1
Array: 0.021562099456787 <br /> Object: 0.039951086044312 <br /> Cast: 0.024637937545776 <br />
Output for 5.1.0
Array: 0.026193857192993 <br /> Object: 0.042302131652832 <br /> Cast: 0.02344799041748 <br />
Output for 5.0.5
Array: 0.041671991348267 <br /> Object: 0.092741012573242 <br /> Cast: 0.054253101348877 <br />
Output for 5.0.4
Array: 0.062745094299316 <br /> Object: 0.092866182327271 <br /> Cast: 0.049526929855347 <br />
Output for 5.0.3
Array: 0.040452003479004 <br /> Object: 0.070301055908203 <br /> Cast: 0.048830032348633 <br />
Output for 5.0.2
Array: 0.044428110122681 <br /> Object: 0.069699048995972 <br /> Cast: 0.052833080291748 <br />
Output for 5.0.1
Array: 0.057812929153442 <br /> Object: 0.07553505897522 <br /> Cast: 0.046028852462769 <br />
Output for 5.0.0
Array: 0.074484825134277 <br /> Object: 0.085086107254028 <br /> Cast: 0.077680110931396 <br />
Output for 4.4.9
Array: 0.057239 <br /> Object: 0.073432 <br /> Cast: 0.073036 <br />
Output for 4.4.8
Array: 0.056867 <br /> Object: 0.067609 <br /> Cast: 0.044782 <br />
Output for 4.4.7
Array: 0.051331 <br /> Object: -0.903112 <br /> Cast: 0.044098 <br />
Output for 4.4.6
Array: 0.045566 <br /> Object: 0.065694 <br /> Cast: 0.04665 <br />
Output for 4.4.5
Array: 0.045078 <br /> Object: 0.067927 <br /> Cast: 0.058617 <br />
Output for 4.4.4
Array: 0.043321 <br /> Object: 0.071203 <br /> Cast: 0.045637 <br />
Output for 4.4.3
Array: 0.045258 <br /> Object: 0.067269 <br /> Cast: 0.050037 <br />
Output for 4.4.2
Array: 0.052701 <br /> Object: -0.922269 <br /> Cast: 0.043953 <br />
Output for 4.4.1
Array: 0.046791 <br /> Object: 0.07545 <br /> Cast: 0.051773 <br />
Output for 4.4.0
Array: 0.053724 <br /> Object: 0.076183 <br /> Cast: 0.049102 <br />
Output for 4.3.11
Array: 0.065254 <br /> Object: 0.107676 <br /> Cast: 0.041316 <br />
Output for 4.3.10
Array: 0.044146 <br /> Object: 0.068657 <br /> Cast: 0.043759 <br />
Output for 4.3.9
Array: 0.052044 <br /> Object: -0.915031 <br /> Cast: 0.050616 <br />
Output for 4.3.8
Array: 0.055786 <br /> Object: 0.121637 <br /> Cast: 0.062689 <br />
Output for 4.3.7
Array: 0.051998 <br /> Object: 0.072435 <br /> Cast: 0.053983 <br />
Output for 4.3.6
Array: 0.04414 <br /> Object: 0.076581 <br /> Cast: 0.045514 <br />
Output for 4.3.5
Array: 0.055162 <br /> Object: 0.099311 <br /> Cast: -0.9175 <br />
Output for 4.3.4
Array: 0.04162 <br /> Object: 0.085162 <br /> Cast: 0.045728 <br />
Output for 4.3.3
Array: 0.045479 <br /> Object: 0.069459 <br /> Cast: 0.04253 <br />
Output for 4.3.2
Array: 0.040371 <br /> Object: 0.066252 <br /> Cast: 0.056353 <br />
Output for 4.3.1
Array: 0.063528 <br /> Object: 0.110861 <br /> Cast: 0.074692 <br />
Output for 4.3.0
Array: 0.053713 <br /> Object: 0.078611 <br /> Cast: 0.036164 <br />