3v4l.org

run code in 300+ PHP versions simultaneously
<?php function applyHLToSiblings(DOMDocument $D){ $words[0] = "cart"; /* $words[1] = "car"; $words[2] = "cartel"; $words[3] = "art"; $words[4] = "drug"; $words[5] = "drugs"; $words[6] = "rug"; $words[7] = "rugs"; */ $ps = function($siblingsContainer, $searchString, $name) use($D){ foreach($siblingsContainer->childNodes as $node){ if($node instanceof DOMText){ if(mb_strlen($node->textContent, "UTF-8") >= mb_strlen($searchString)){ $o = mb_strpos($node->textContent, $searchString); if($o !== false){ $l = mb_strlen($searchString, "UTF-8"); $before = mb_substr($node->textContent, 0, $o); $wrap = mb_substr($node->textContent, $o, $l); $after = mb_substr($node->textContent, $o + $l); var_dump($before); var_dump($wrap); var_dump($after); } } } } }; foreach($words as $name => $word) $ps($D->documentElement, $word, $name); } $x = new DOMDocument(); $x->loadXML("<data>drugs cartel</data>"); applyHLToSiblings($x);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0110.00418.55
8.3.50.0130.00922.04
8.3.40.0070.00719.13
8.3.30.0100.01018.88
8.3.20.0000.00820.59
8.3.10.0000.00723.82
8.3.00.0080.00019.62
8.2.180.0110.00416.88
8.2.170.0090.00922.96
8.2.160.0070.00720.44
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00417.75
8.2.120.0030.00526.35
8.2.110.0060.00322.57
8.2.100.0140.00018.16
8.2.90.0050.00319.55
8.2.80.0080.00017.97
8.2.70.0080.00017.75
8.2.60.0050.00318.05
8.2.50.0030.00718.07
8.2.40.0000.00819.53
8.2.30.0000.00720.80
8.2.20.0040.00518.01
8.2.10.0040.00418.39
8.2.00.0000.00718.41
8.1.280.0100.00725.92
8.1.270.0030.00523.99
8.1.260.0050.00328.09
8.1.250.0000.00728.09
8.1.240.0100.01022.72
8.1.230.0060.00617.79
8.1.220.0070.00417.91
8.1.210.0060.00318.77
8.1.200.0000.00817.60
8.1.190.0000.00917.47
8.1.180.0000.00818.10
8.1.170.0030.00518.90
8.1.160.0040.00422.25
8.1.150.0040.00419.18
8.1.140.0030.00619.75
8.1.130.0060.00317.92
8.1.120.0060.00317.64
8.1.110.0040.00417.58
8.1.100.0050.00217.73
8.1.90.0040.00417.73
8.1.80.0060.00317.59
8.1.70.0040.00417.52
8.1.60.0000.00817.84
8.1.50.0000.00917.87
8.1.40.0040.00417.86
8.1.30.0030.00517.84
8.1.20.0050.00317.89
8.1.10.0040.00417.71
8.1.00.0070.00717.75
8.0.300.0000.00718.77
8.0.290.0040.00417.00
8.0.280.0030.00318.68
8.0.270.0040.00417.61
8.0.260.0080.00017.53
8.0.250.0000.00717.36
8.0.240.0040.00417.30
8.0.230.0090.00017.34
8.0.220.0030.00317.15
8.0.210.0000.00717.24
8.0.200.0070.00017.34
8.0.190.0040.00417.17
8.0.180.0000.00717.29
8.0.170.0000.00817.32
8.0.160.0070.00017.16
8.0.150.0070.00317.20
8.0.140.0080.00317.25
8.0.130.0000.00713.59
8.0.120.0000.00817.11
8.0.110.0000.00817.29
8.0.100.0040.00417.14
8.0.90.0000.00717.11
8.0.80.0040.01117.38
8.0.70.0000.00817.28
8.0.60.0000.00817.13
8.0.50.0050.00217.09
8.0.30.0090.01217.26
8.0.20.0070.01217.45
8.0.10.0050.00317.11
8.0.00.0130.00817.08
7.4.330.0030.00316.86
7.4.320.0000.00616.74
7.4.300.0030.00316.80
7.4.290.0030.00316.76
7.4.280.0050.00216.77
7.4.270.0070.00016.75
7.4.260.0030.00316.88
7.4.250.0030.00516.72
7.4.240.0010.00616.73
7.4.230.0000.00716.76
7.4.220.0250.00816.83
7.4.210.0080.01116.82
7.4.200.0000.00716.75
7.4.160.0130.00316.66
7.4.150.0130.00417.40
7.4.140.0090.01517.86
7.4.130.0070.01316.77
7.4.120.0100.00716.83
7.4.110.0090.00916.77
7.4.100.0090.00916.79
7.4.90.0150.00316.62
7.4.80.0070.01019.39
7.4.70.0100.01716.79
7.4.60.0100.00716.71
7.4.50.0070.00716.56
7.4.40.0110.01116.78
7.4.30.0070.01616.88
7.4.00.0040.01115.14
7.3.330.0000.00513.65
7.3.320.0000.00613.34
7.3.310.0030.00316.69
7.3.300.0000.00616.55
7.3.290.0040.00416.44
7.3.280.0110.00716.56
7.3.270.0080.00817.40
7.3.260.0090.01216.86
7.3.250.0110.00716.65
7.3.240.0100.01316.72
7.3.230.0100.00716.93
7.3.210.0150.00916.78
7.3.200.0090.00616.77
7.3.190.0080.00916.70
7.3.180.0100.01016.80
7.3.170.0070.01016.59
7.3.160.0130.00616.80
7.2.330.0060.01216.88
7.2.320.0150.00417.09
7.2.310.0160.00317.06
7.2.300.0140.00716.65
7.2.290.0030.01317.00
7.2.00.0080.00319.37
7.1.200.0060.00616.04
7.1.100.0260.00317.45
7.1.70.0040.00417.34
7.1.60.0090.01519.36
7.1.50.0070.00717.18
7.1.00.0030.07722.54
7.0.200.0050.00217.04
7.0.60.0030.07320.00
7.0.50.0030.08318.11
7.0.40.0100.05320.06
7.0.30.0270.07020.30
7.0.20.0200.04320.17
7.0.10.0170.06020.26
7.0.00.0030.04720.36
5.6.280.0070.07021.17
5.6.210.0070.08320.55
5.6.200.0070.08318.36
5.6.190.0200.07720.61
5.6.180.0430.07020.55
5.6.170.0130.06720.66
5.6.160.0100.07720.63
5.6.150.0170.07318.32
5.6.140.0030.04318.32
5.6.130.0030.07018.23
5.6.120.0070.05321.01
5.6.110.0070.08721.12
5.6.100.0170.03321.09
5.6.90.0070.08321.18
5.6.80.0000.04320.43
5.5.350.3770.03320.49
5.5.340.0100.07718.11
5.5.330.0130.07320.33
5.5.320.0070.04720.43
5.5.310.0170.08320.42
5.5.300.0100.08318.16
5.5.290.0100.08018.15
5.5.280.0100.07320.93
5.5.270.0100.05720.84
5.5.260.0130.05320.84
5.5.250.0000.06320.54
5.5.240.0270.06020.26

preferences:
31.85 ms | 401 KiB | 5 Q