3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "1": [ { "row": "My name is Trevor\n" }, { "row": "Can you see me?\n" }, { "row": "\f" } ], "2": [ { "row": "Hey there! Some other text.\n" }, { "row": "What is up Trevor?\n" }, { "row": "\f" } ], "3": [ { "row": "Some text on the third column. First row." }, { "row": "\f" } ] }'; $content = json_decode($json, true); class regexTextReplace { private $pattern; private $replacement; public function __construct(array $arguments) { $this->pattern = $arguments['pattern']; $this->replacement = $arguments['replacement']; } public function apply(array $table, $column = false): array { $table = $column ? $table[$column] : $table; return array_map('self::regex_replace', $table); } public function regex_replace(array $table) { return preg_replace($this->pattern, $this->replacement, $table); } } $options = [ 'pattern' => '/Trevor/i', 'replacement' => 'Oliver', ]; $engine = new regexTextReplace($options); foreach($content as $key => $v){ $columns[$key] = $engine->apply($content, $key); } var_dump($columns);

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.0130.00316.88
8.3.50.0070.00918.53
8.3.40.0110.01119.05
8.3.30.0070.01119.09
8.3.20.0000.00821.83
8.3.10.0090.00020.86
8.3.00.0070.00721.89
8.2.180.0120.00325.92
8.2.170.0110.00722.96
8.2.160.0090.00622.21
8.2.150.0000.01124.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0090.00921.10
8.2.110.0030.00720.93
8.2.100.0030.00818.16
8.2.90.0040.00420.63
8.2.80.0000.00820.53
8.2.70.0040.00417.75
8.2.60.0080.00017.75
8.2.50.0070.00019.21
8.2.40.0030.00519.11
8.2.30.0080.00020.55
8.2.20.0040.00418.18
8.2.10.0090.00019.07
8.2.00.0040.00418.12
8.1.280.0090.00625.92
8.1.270.0080.00020.71
8.1.260.0030.00526.35
8.1.250.0050.00328.09
8.1.240.0090.00021.31
8.1.230.0110.00021.04
8.1.220.0080.00017.77
8.1.210.0000.00818.88
8.1.200.0030.00617.50
8.1.190.0000.00917.35
8.1.180.0050.00318.10
8.1.170.0060.00318.66
8.1.160.0040.00418.95
8.1.150.0040.00418.94
8.1.140.0050.00220.41
8.1.130.0030.00520.08
8.1.120.0050.00317.63
8.1.110.0000.00817.54
8.1.100.0070.00017.53
8.1.90.0040.00417.61
8.1.80.0040.00417.63
8.1.70.0050.00317.68
8.1.60.0040.00417.75
8.1.50.0000.00817.67
8.1.40.0030.00617.71
8.1.30.0000.00917.78
8.1.20.0060.00317.82
8.1.10.0070.00317.73
8.1.00.0000.00817.55
8.0.300.0070.00220.03
8.0.290.0040.00417.00
8.0.280.0030.00318.42
8.0.270.0050.00316.99
8.0.260.0070.00018.49
8.0.250.0030.00317.04
8.0.240.0000.00817.15
8.0.230.0000.00717.14
8.0.220.0000.00717.06
8.0.210.0000.00717.07
8.0.200.0030.00517.13
8.0.190.0080.00017.14
8.0.180.0040.00417.09
8.0.170.0060.00616.97
8.0.160.0040.00417.07
8.0.150.0070.00017.01
8.0.140.0000.00717.10
8.0.130.0030.00313.51
8.0.120.0050.00217.05
8.0.110.0040.00417.07
8.0.100.0040.00417.08
8.0.90.0030.00516.95
8.0.80.0100.00717.01
8.0.70.0050.00217.04
8.0.60.0000.00717.04
8.0.50.0070.00016.94
8.0.30.0090.00917.22
8.0.20.0130.01017.33
8.0.10.0030.00517.08
8.0.00.0100.01116.93
7.4.330.0020.00215.55
7.4.320.0060.00016.79
7.4.300.0000.00616.75
7.4.290.0000.00816.72
7.4.280.0000.00816.65
7.4.270.0030.00616.74
7.4.260.0000.00716.77
7.4.250.0020.00516.70
7.4.240.0000.00816.85
7.4.230.0040.00416.95
7.4.220.0050.00316.91
7.4.210.0070.00816.88
7.4.200.0030.00416.91
7.4.160.0050.01216.77
7.4.130.0040.01216.83
7.4.120.0170.00016.70
7.4.110.0120.01116.72
7.4.100.0090.00916.67
7.4.90.0030.02016.58
7.4.80.0070.01019.39
7.4.70.0080.00816.90
7.4.60.0120.01016.87
7.4.50.0070.00716.36
7.4.40.0070.01216.75
7.4.10.0120.00615.26
7.4.00.0070.01015.14
7.3.330.0030.00313.34
7.3.320.0030.00313.34
7.3.310.0000.00816.55
7.3.300.0000.00716.39
7.3.290.0000.00716.41
7.3.280.0090.00816.52
7.3.260.0100.01016.69
7.3.240.0110.00716.67
7.3.230.0110.00716.66
7.3.210.0100.00716.62
7.3.200.0000.01916.55
7.3.190.0080.01216.71
7.3.180.0090.00916.91
7.3.170.0130.00316.51
7.3.160.0130.00516.93
7.3.130.0030.01615.15
7.3.120.0060.01214.83
7.3.110.0070.01014.87
7.3.100.0110.00314.86
7.3.90.0090.00915.33
7.3.80.0110.00415.04
7.3.70.0090.00615.20
7.3.60.0130.00314.96
7.3.50.0110.00815.04
7.3.40.0140.00414.88
7.3.30.0130.01015.00
7.3.20.0040.01316.88
7.3.10.0090.00516.90
7.3.00.0150.00316.71
7.2.330.0140.00317.00
7.2.320.0100.00716.74
7.2.310.0100.01016.91
7.2.300.0090.01217.04
7.2.290.0060.01316.93
7.2.260.0060.01215.45
7.2.250.0060.01315.26
7.2.240.0100.00315.02
7.2.230.0100.00715.49
7.2.220.0090.00915.06
7.2.210.0000.01015.43
7.2.200.0050.00515.29
7.2.190.0060.00915.31
7.2.180.0060.00615.19
7.2.170.0110.00515.42
7.2.160.0100.01215.31
7.2.150.0100.00717.00
7.2.140.0030.01217.12
7.2.130.0090.00817.11
7.2.120.0040.01017.03
7.2.110.0110.00417.12
7.2.100.0090.01117.08
7.2.90.0060.00717.13
7.2.80.0050.01617.06
7.2.70.0060.00717.20
7.2.60.0060.00717.13
7.2.50.0100.01017.15
7.2.40.0090.00916.94
7.2.30.0010.01217.00
7.2.20.0110.00816.94
7.2.10.0050.01217.02
7.2.00.0080.00617.13
7.1.330.0110.00415.85
7.1.320.0070.01115.85
7.1.310.0060.00916.01
7.1.300.0030.01315.90
7.1.290.0060.00316.14
7.1.280.0080.00816.03
7.1.270.0060.01016.02
7.1.260.0110.00416.07
7.1.250.0060.00616.11
7.1.240.0060.00315.94
7.1.230.0070.00715.99
7.1.220.0030.01015.77
7.1.210.0070.00715.80
7.1.200.0040.01115.93
7.1.190.0090.00615.94
7.1.180.0070.00715.74
7.1.170.0030.01315.94
7.1.160.0080.00815.73
7.1.150.0030.01016.16
7.1.140.0030.01016.09
7.1.130.0060.00916.14
7.1.120.0030.00615.78
7.1.110.0070.00715.91
7.1.100.0000.01416.00
7.1.90.0050.00816.03
7.1.80.0080.00315.87
7.1.70.0070.00716.16
7.1.60.0080.00816.09
7.1.50.0100.00316.02
7.1.40.0000.01315.73
7.1.30.0070.00715.81
7.1.20.0060.00815.76
7.1.10.0080.00516.00
7.1.00.0000.01315.91

preferences:
58.65 ms | 401 KiB | 5 Q