3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Benchmark using GLOBAL variables $startTime = microtime(true); for ($i = 0; $i < 10000; $i++) { global $myVar; $myVar = $i; } $endTime = microtime(true); $globalTime = $endTime - $startTime; // Benchmark using a function $startTime = microtime(true); function setVar($value) { return $value; } for ($i = 0; $i < 10000; $i++) { $myVar = setVar($i); } $endTime = microtime(true); $functionTime = $endTime - $startTime; echo "GLOBAL: $globalTime seconds\n"; echo "FUNCTION: $functionTime seconds\n";
Output for 8.2.10
GLOBAL: 0.00013494491577148 seconds FUNCTION: 0.00015497207641602 seconds
Output for 8.2.9
GLOBAL: 0.00011682510375977 seconds FUNCTION: 0.0001530647277832 seconds
Output for 8.2.8
GLOBAL: 0.00011777877807617 seconds FUNCTION: 0.0001530647277832 seconds
Output for 8.2.7
GLOBAL: 0.00011706352233887 seconds FUNCTION: 0.00017690658569336 seconds
Output for 8.2.6
GLOBAL: 0.00013303756713867 seconds FUNCTION: 0.00015592575073242 seconds
Output for 8.2.5
GLOBAL: 0.00011587142944336 seconds FUNCTION: 0.0001521110534668 seconds
Output for 8.2.4
GLOBAL: 0.00011301040649414 seconds FUNCTION: 0.00015401840209961 seconds
Output for 8.2.3
GLOBAL: 0.00012397766113281 seconds FUNCTION: 0.00018000602722168 seconds
Output for 8.2.2
GLOBAL: 0.00011801719665527 seconds FUNCTION: 0.00015711784362793 seconds
Output for 8.2.1
GLOBAL: 0.0001220703125 seconds FUNCTION: 0.0001530647277832 seconds
Output for 8.2.0
GLOBAL: 0.00013399124145508 seconds FUNCTION: 0.0001530647277832 seconds
Output for 8.1.23
GLOBAL: 0.00014209747314453 seconds FUNCTION: 0.00021600723266602 seconds
Output for 8.1.22
GLOBAL: 0.00012803077697754 seconds FUNCTION: 0.0001528263092041 seconds
Output for 8.1.21
GLOBAL: 0.00014686584472656 seconds FUNCTION: 0.00015592575073242 seconds
Output for 8.1.20
GLOBAL: 0.00012111663818359 seconds FUNCTION: 0.00015711784362793 seconds
Output for 8.1.19
GLOBAL: 0.00012302398681641 seconds FUNCTION: 0.00015902519226074 seconds
Output for 8.1.18
GLOBAL: 0.0001220703125 seconds FUNCTION: 0.00017094612121582 seconds
Output for 8.0.23, 8.1.17
GLOBAL: 0.00011897087097168 seconds FUNCTION: 0.00015711784362793 seconds
Output for 8.1.16
GLOBAL: 0.00012302398681641 seconds FUNCTION: 0.00016117095947266 seconds
Output for 8.1.15
GLOBAL: 0.00013995170593262 seconds FUNCTION: 0.00015616416931152 seconds
Output for 8.1.8, 8.1.14
GLOBAL: 0.00012016296386719 seconds FUNCTION: 0.00015497207641602 seconds
Output for 8.1.13
GLOBAL: 0.00012516975402832 seconds FUNCTION: 0.00015783309936523 seconds
Output for 8.1.12
GLOBAL: 0.0001220703125 seconds FUNCTION: 0.00018811225891113 seconds
Output for 8.1.11
GLOBAL: 0.00011801719665527 seconds FUNCTION: 0.00015401840209961 seconds
Output for 8.1.10
GLOBAL: 0.00012016296386719 seconds FUNCTION: 0.0001528263092041 seconds
Output for 8.1.9
GLOBAL: 0.00013089179992676 seconds FUNCTION: 0.0001680850982666 seconds
Output for 8.1.7
GLOBAL: 0.00012016296386719 seconds FUNCTION: 0.00015783309936523 seconds
Output for 8.1.6
GLOBAL: 0.00011992454528809 seconds FUNCTION: 0.00019311904907227 seconds
Output for 8.1.5
GLOBAL: 0.00014019012451172 seconds FUNCTION: 0.00016283988952637 seconds
Output for 8.1.4
GLOBAL: 0.00011897087097168 seconds FUNCTION: 0.00016117095947266 seconds
Output for 8.1.3
GLOBAL: 0.00014281272888184 seconds FUNCTION: 0.00018215179443359 seconds
Output for 8.1.2
GLOBAL: 0.00011992454528809 seconds FUNCTION: 0.00016403198242188 seconds
Output for 8.1.1
GLOBAL: 0.00012111663818359 seconds FUNCTION: 0.00015401840209961 seconds
Output for 8.1.0
GLOBAL: 0.00012302398681641 seconds FUNCTION: 0.00015592575073242 seconds
Output for 8.0.30
GLOBAL: 0.0015149116516113 seconds FUNCTION: 0.00021004676818848 seconds
Output for 8.0.29
GLOBAL: 0.0016820430755615 seconds FUNCTION: 0.00021696090698242 seconds
Output for 8.0.28
GLOBAL: 0.0014407634735107 seconds FUNCTION: 0.00021481513977051 seconds
Output for 8.0.27
GLOBAL: 0.0014309883117676 seconds FUNCTION: 0.00020194053649902 seconds
Output for 8.0.26
GLOBAL: 0.0014240741729736 seconds FUNCTION: 0.00023484230041504 seconds
Output for 8.0.25
GLOBAL: 0.0013949871063232 seconds FUNCTION: 0.00015807151794434 seconds
Output for 8.0.24
GLOBAL: 0.0012800693511963 seconds FUNCTION: 0.00015711784362793 seconds
Output for 8.0.22
GLOBAL: 0.00011777877807617 seconds FUNCTION: 0.00017809867858887 seconds
Output for 8.0.21
GLOBAL: 0.00016117095947266 seconds FUNCTION: 0.00020098686218262 seconds
Output for 8.0.20
GLOBAL: 0.00016188621520996 seconds FUNCTION: 0.00019717216491699 seconds
Output for 8.0.19
GLOBAL: 0.00016093254089355 seconds FUNCTION: 0.00020599365234375 seconds
Output for 8.0.18
GLOBAL: 0.00016307830810547 seconds FUNCTION: 0.00020289421081543 seconds
Output for 8.0.17
GLOBAL: 0.00011897087097168 seconds FUNCTION: 0.00015997886657715 seconds
Output for 8.0.16
GLOBAL: 0.0001227855682373 seconds FUNCTION: 0.00015783309936523 seconds
Output for 8.0.15
GLOBAL: 0.00014400482177734 seconds FUNCTION: 0.00019598007202148 seconds
Output for 8.0.14
GLOBAL: 0.00016307830810547 seconds FUNCTION: 0.00021505355834961 seconds
Output for 8.0.13
GLOBAL: 0.00016617774963379 seconds FUNCTION: 0.00020194053649902 seconds
Output for 8.0.12
GLOBAL: 0.00015997886657715 seconds FUNCTION: 0.00022387504577637 seconds
Output for 8.0.11
GLOBAL: 0.0013580322265625 seconds FUNCTION: 0.00015711784362793 seconds
Output for 8.0.10
GLOBAL: 0.0013911724090576 seconds FUNCTION: 0.0001530647277832 seconds
Output for 8.0.9
GLOBAL: 0.001384973526001 seconds FUNCTION: 0.00015902519226074 seconds
Output for 8.0.8
GLOBAL: 0.002824068069458 seconds FUNCTION: 0.00036287307739258 seconds
Output for 8.0.7
GLOBAL: 0.001413106918335 seconds FUNCTION: 0.00020790100097656 seconds
Output for 8.0.6
GLOBAL: 0.001511812210083 seconds FUNCTION: 0.00020480155944824 seconds
Output for 8.0.5
GLOBAL: 0.0015149116516113 seconds FUNCTION: 0.00020408630371094 seconds
Output for 8.0.3
GLOBAL: 0.00011897087097168 seconds FUNCTION: 0.00017905235290527 seconds
Output for 8.0.2
GLOBAL: 0.0001530647277832 seconds FUNCTION: 0.0014429092407227 seconds
Output for 8.0.1
GLOBAL: 0.0013728141784668 seconds FUNCTION: 0.00024700164794922 seconds

preferences:
99.98 ms | 402 KiB | 69 Q