3v4l.org

run code in 300+ PHP versions simultaneously
<?php $regex = '/(?<!<br>)(?<!\s)\s*(\((?:(?:(?!<br>|\(|\)).)*(?:\((?:(?!<br>|\(|\)).)*\))?)*?\))\s*(\{)/si'; $test_string = '<br> var allowed = true, human_exists = true, stop_computers = false, current_player_number = 1, row_amount = 6, column_amount = 7;<br> function check_board () {<br> computer_number = current_player_number;<br> other_player_number = (computer_number === 1) ? 2 : 1;<br> var board = {};<br> $(""STRING"").each(function () {<br> if ($(this).hasClass(""STRING"" + other_player_number)) {<br> board[this.id] = 1;<br> }<br> else if ($(this).hasClass(""STRING"" + computer_number)) {<br> board[this.id] = 2;<br> }<br> else {<br> board[this.id] = 0;<br> }<br> });<br> board = {""STRING"": JSON.stringify(board), ""STRING"": column_amount, ""STRING"": row_amount};<br> $.ajax ({<br> type: ""STRING"",<br> url: ""STRING"",<br> data: board,<br> success: function (data) {<br> input = board;<br> output = data;<br> board = JSON.parse(data);<br> if (!board[""STRING""] ""SYMBOL""""SYMBOL"" board[""STRING""] === false) {<br> $(""STRING"").html($(""STRING"" + other_player_number + ""STRING"").html());<br> $(""STRING"")[0].style.backgroundColor = (other_player_number === 1) ? ""STRING"": ""STRING"";<br> current_player_number = other_player_number;<br> allowed = true;<br> }<br> else if (board[""STRING""]) {<br> $(""STRING"").html(""STRING"");<br> $(""STRING"").html(""STRING"");<br> $(""STRING"")[0].style.display = ""STRING"";<br> current_player_number = null;<br> }<br> else {<br> if (board[""STRING""] === 1 || board[""STRING""] === ""STRING"") {<br> $(""STRING"").html($(""STRING"" + other_player_number + ""STRING"").html() + ""STRING"");<br> $(""STRING"").html(""STRING"");<br> $(""STRING"")[0].style.display = ""STRING"";<br> $(""STRING"" + other_player_number + ""STRING"").html(parseInt($(""STRING"" + other_player_number + ""STRING"").html(), 10) + 1);<br> }<br> else {<br> $(""STRING"").html($(""STRING"" + computer_number + ""STRING"").html() + ""STRING"");<br> $(""STRING"").html(""STRING"");<br> $(""STRING"")[0].style.display = ""STRING"";<br> $(""STRING"" + computer_number + ""STRING"").html(parseInt($(""STRING"" + computer_number + ""STRING"").html(), 10) + 1);<br> }<br> current_player_number = null;<br> }<br> },<br> fail: function (one, two, three) {<br> console.log(one);<br> console.log(two);<br> console.log(three);<br> }<br> });<br> }<br> function computer_turn_process () {<br> allowed = false;<br> computer_number = current_player_number;<br> other_player_number = (computer_number === 1) ? 2 : 1;<br> var board = {};<br> $(""STRING"").each(function () {<br> if ($(this).hasClass(""STRING"" + other_player_number)) {<br> board[this.id] = 1;<br> }<br> else if ($(this).hasClass(""STRING"" + computer_number)) {<br> board[this.id] = 2;<br> }<br> else {<br> board[this.id] = 0;<br> }<br> });<br> board = {""STRING"": JSON.stringify(board), ""STRING"": true, ""STRING"": column_amount, ""STRING"": row_amount};<br> $.ajax ({<br> type: ""STRING"",<br> url: ""STRING"",<br> data: board,<br> success: function (data) {<br> input = board;<br> output = data;<br> board = JSON.parse(data);<br> for (var index_new = 0;<br> index_new ""SYMBOL"" (row_amount * column_amount);<br> index_new++) {<br> if (board[index_new] === 1) {<br> if (computer_number !== other_player_number) {<br> $(""STRING"" + index_new).removeClass(""STRING"" + computer_number).addClass(""STRING"" + other_player_number);<br> }<br> }<br> else if (board[index_new] === 2) {<br> if (computer_number !== other_player_number) {<br> $(""STRING"" + index_new).removeClass(""STRING"" + other_player_number).addClass(""STRING"" + computer_number);<br> }<br> }<br> }<br> if (!board[""STRING""] ""SYMBOL""""SYMBOL"" board[""STRING""] ""SYMBOL""""SYMBOL"" board[""STRING""] === false) {<br> $(""STRING"").html($(""STRING"" + other_player_number + ""STRING"").html());<br> $(""STRING"")[0].style.backgroundColor = (other_player_number === 1) ? ""STRING"": ""STRING"";<br> current_player_number = other_player_number;<br> if (human_exists) {<br> allowed = true;<br> }<br> else if (!stop_computers) {<br> computer_turn_process ();<br> }<br> }<br> else if (board[""STRING""]) {<br> $(""STRING"").html(""STRING"");<br> $(""STRING"").html(""STRING"");<br> $(""STRING"")[0].style.display = ""STRING"";<br> current_player_number = null;<br> }<br> else {<br> if (board[""STRING""] === 1 || board[""STRING""] === ""STRING"") {<br> $(""STRING"").html($(""STRING"" + other_player_number + ""STRING"").html() + ""STRING"");<br> $(""STRING"").html(""STRING"");<br> $(""STRING"")[0].style.display = ""STRING"";<br> $(""STRING"" + other_player_number + ""STRING"").html(parseInt($(""STRING"" + other_player_number + ""STRING"").html(), 10) + 1);<br> }<br> else {<br> $(""STRING"").html($(""STRING"" + computer_number + ""STRING"").html() + ""STRING"");<br> $(""STRING"").html(""STRING"");<br> $(""STRING"")[0].style.display = ""STRING"";<br> $(""STRING"" + computer_number + ""STRING"").html(parseInt($(""STRING"" + computer_number + ""STRING"").html(), 10) + 1);<br> }<br> current_player_number = null;<br> }<br> },<br> fail: function (one, two, three) {<br> console.log(one);<br> console.log(two);<br> console.log(three);<br> }<br> });<br> }<br> $(""STRING"").each(function () {<br> this.innerHTML = ""STRING"";<br> });<br> function human_and_computer_turns (noclick) {<br> human_exists = true;<br> if ($(""STRING"").val() === ""STRING"") {<br> computer_number = 2;<br> }<br> else {<br> computer_number = 1;<br> }<br> other_player_number = (computer_number === 1) ? 2 : 1;<br> if (noclick !== ""STRING"") {<br> column = Math.floor(this.id % column_amount);<br> if (allowed) {<br> allowed = false;<br> for (var index = column + (column_amount * (row_amount - 1));<br> index ""SYMBOL""= column;<br> index -= column_amount) {<br> if (!$(""STRING"" + index).hasClass(""STRING"" + computer_number) ""SYMBOL""""SYMBOL"" !$(""STRING"" + index).hasClass(""STRING"" + other_player_number)) {<br> $(""STRING"" + index).addClass(""STRING"" + other_player_number);<br> $(""STRING"").html($(""STRING"" + computer_number + ""STRING"").html());<br> current_player_number = computer_number;<br> $(""STRING"")[0].style.backgroundColor = (other_player_number === 1) ? ""STRING"" : ""STRING"";<br> computer_turn_process(computer_number);<br> break;<br> }<br> else if (index === column) {<br> ""COMMENT""allowed = true;<br> }<br> }<br> }<br> }<br> else {<br> allowed = false;<br> computer_turn_process(computer_number);<br> }<br> }<br> function human_only_turns () {<br> human_exists = true;<br> other_player_number = (current_player_number === 1) ? 2 : 1;<br> column = Math.floor(this.id % column_amount);<br> if (allowed) {<br> allowed = false;<br> for (var index = column + (column_amount * (row_amount - 1));<br> index ""SYMBOL""= column;<br> index -= column_amount) {<br> if (!$(""STRING"" + index).hasClass(""STRING"" + current_player_number) ""SYMBOL""""SYMBOL"" !$(""STRING"" + index).hasClass(""STRING"" + other_player_number)) {<br> $(""STRING"" + index).addClass(""STRING"" + current_player_number);<br> check_board();<br> break;<br> }<br> else if (index === column) {<br> ""COMMENT""allowed = true;<br> }<br> }<br> }<br> }<br> function start_game () {<br> if (current_player_number === null) {<br> return false;<br> }<br> $(""STRING"").unbind(""STRING"", human_and_computer_turns);<br> $(""STRING"").unbind(""STRING"", human_only_turns);<br> ""COMMENT""stop_computers = true;<br> if ($(""STRING"").val() === ""STRING"" ""SYMBOL""""SYMBOL"" $(""STRING"").val() === ""STRING"") {<br> allowed = false;<br> human_exists = false;<br> stop_computers = false;<br> computer_turn_process(1);<br> }<br> else if ($(""STRING"").val() === ""STRING"" ""SYMBOL""""SYMBOL"" $(""STRING"").val() === ""STRING"") {<br> allowed = true;<br> $(""STRING"").on(""STRING"", human_only_turns);<br> }<br> else {<br> if ($(""STRING"").val() === ""STRING"") {<br> computer_number = 2;<br> }<br> else {<br> computer_number = 1;<br> }<br> if (current_player_number === computer_number) {<br> allowed = false;<br> human_and_computer_turns(""STRING"");<br> }<br> else {<br> allowed = true;<br> }<br> $(""STRING"").on(""STRING"", human_and_computer_turns);<br> }<br> }<br> $(""STRING"").click(function () {<br> current_player_number = 1;<br> $(""STRING"").each(function () {<br> this.className = ""STRING"";<br> });<br> $(""STRING"").html(""STRING"");<br> $(""STRING"").html($(""STRING"").html());<br> $(""STRING"")[0].style.display = ""STRING"";<br> $(""STRING"")[0].style.backgroundColor = ""STRING"";<br> start_game();<br> });<br> $(""STRING"").on(""STRING"", function (event) {<br> return clean (event, ""STRING"");<br> }).on(""STRING"", function () {<br> this.value = clean_paste (this.value, ""STRING"");<br> $(""STRING"" + this.id).html(this.value.toUpperCase());<br> });<br> $(""STRING"").on(""STRING"", function () {<br> start_game();<br> });<br> $(function () {<br> start_game();<br> });'; echo preg_replace($regex,' $1 $2',$test_string);

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.0090.00916.50
8.3.50.0120.01122.03
8.3.40.0120.00618.84
8.3.30.0110.00719.08
8.3.20.0060.00320.13
8.3.10.0030.00723.53
8.3.00.0100.00019.51
8.2.180.0040.01418.17
8.2.170.0120.00922.96
8.2.160.0120.00620.25
8.2.150.0060.00324.18
8.2.140.0000.01024.66
8.2.130.0030.00726.16
8.2.120.0040.00822.32
8.2.110.0040.01122.33
8.2.100.0000.01418.05
8.2.90.0070.00319.23
8.2.80.0000.01017.97
8.2.70.0090.00517.38
8.2.60.0030.00718.04
8.2.50.0040.00718.07
8.2.40.0000.01118.16
8.2.30.0030.00718.05
8.2.20.0030.00717.97
8.2.10.0000.01118.02
8.2.00.0030.01317.80
8.1.280.0100.01025.92
8.1.270.0030.00722.32
8.1.260.0030.00626.35
8.1.250.0050.00528.09
8.1.240.0100.00022.48
8.1.230.0090.00617.76
8.1.220.0000.01017.76
8.1.210.0040.00718.77
8.1.200.0000.01217.35
8.1.190.0040.00717.41
8.1.180.0060.00618.10
8.1.170.0000.01118.74
8.1.160.0000.01122.13
8.1.150.0030.00718.67
8.1.140.0030.00717.58
8.1.130.0030.00617.89
8.1.120.0100.00017.62
8.1.110.0040.00717.53
8.1.100.0000.01017.46
8.1.90.0000.01017.57
8.1.80.0070.00317.57
8.1.70.0000.01017.55
8.1.60.0030.00817.69
8.1.50.0030.00917.57
8.1.40.0040.00817.54
8.1.30.0030.00817.69
8.1.20.0050.00517.73
8.1.10.0000.01217.65
8.1.00.0030.00717.61
8.0.300.0070.00318.77
8.0.290.0000.01017.17
8.0.280.0000.01018.50
8.0.270.0000.01017.23
8.0.260.0050.00517.33
8.0.250.0060.00317.04
8.0.240.0030.00916.97
8.0.230.0030.00717.10
8.0.220.0030.00616.98
8.0.210.0000.01017.03
8.0.200.0030.00617.08
8.0.190.0000.01017.07
8.0.180.0040.00717.02
8.0.170.0030.00916.95
8.0.160.0030.00717.02
8.0.150.0030.00716.92
8.0.140.0000.01016.98
8.0.130.0050.00513.44
8.0.120.0050.00516.95
8.0.110.0060.00617.06
8.0.100.0000.01016.98
8.0.90.0030.00717.02
8.0.80.0100.01016.95
8.0.70.0000.01017.02
8.0.60.0000.01017.06
8.0.50.0070.00416.84
8.0.30.0110.01617.39
8.0.20.0080.01717.43
8.0.10.0030.00717.03
8.0.00.0080.01717.02
7.4.330.0000.00815.00
7.4.320.0030.00716.72
7.4.300.0030.00716.78
7.4.290.0070.00316.67
7.4.280.0060.00616.59
7.4.270.0030.00716.79
7.4.260.0030.00616.82
7.4.250.0030.00716.66
7.4.240.0020.00716.73
7.4.230.0100.00016.75
7.4.220.0090.01516.64
7.4.210.0070.01316.79
7.4.200.0050.00516.80
7.4.190.0000.01016.83
7.4.160.0100.01316.79
7.4.150.0060.01717.40
7.4.140.0150.01317.86
7.4.130.0050.01716.61
7.4.120.0090.01616.60
7.4.110.0040.02116.74
7.4.100.0130.01016.76
7.4.90.0080.01616.70
7.4.80.0100.01619.39
7.4.70.0140.00816.60
7.4.60.0180.00616.57
7.4.50.0030.00916.57
7.4.40.0130.00622.77
7.4.30.0090.01216.66
7.4.00.0030.01715.03
7.3.330.0000.00813.00
7.3.320.0030.00613.20
7.3.310.0030.00716.19
7.3.300.0030.00616.31
7.3.290.0170.01116.32
7.3.280.0110.01116.34
7.3.270.0100.01417.40
7.3.260.0120.01016.55
7.3.250.0100.01316.66
7.3.240.0090.02216.64
7.3.230.0130.01016.48
7.3.210.0130.01316.43
7.3.200.0070.01919.39
7.3.190.0070.02316.64
7.3.180.0110.01116.51
7.3.170.0090.01216.39
7.3.160.0000.02316.39
7.3.120.0130.00714.69
7.2.330.0030.02016.73
7.2.320.0060.01616.51
7.2.310.0100.01316.66
7.2.300.0130.01016.68
7.2.290.0100.01316.61
7.2.60.0930.01415.27
7.2.00.0000.01919.54
7.1.200.0060.00916.05
7.1.100.0680.0009.73
7.1.70.0060.00617.11
7.1.60.0130.01919.33
7.1.50.0070.02617.10
7.1.00.0070.08022.39
7.0.200.0390.01114.64
7.0.140.0030.07322.15
7.0.60.0300.08319.82
7.0.50.0030.06017.93
7.0.40.0000.05020.02
7.0.30.0170.06720.36
7.0.20.0130.05320.20
7.0.10.0030.06720.06
7.0.00.0030.06020.22
5.6.280.0070.09321.11
5.6.210.0170.09720.72
5.6.200.0100.05718.21
5.6.190.0130.10020.63
5.6.180.0130.05320.47
5.6.170.0270.09320.45
5.6.160.0070.08720.55
5.6.150.0170.09018.19
5.6.140.0170.06018.13
5.6.130.0170.09018.22
5.6.120.0100.11021.13
5.6.110.0170.10021.10
5.6.100.0100.09721.01
5.6.90.0070.08020.89
5.6.80.0130.09020.55
5.5.350.0300.09020.40
5.5.340.0030.07017.89
5.5.330.0200.09320.59
5.5.320.0270.05320.33
5.5.310.0270.07720.20
5.5.300.0100.08317.98
5.5.290.0000.10718.00
5.5.280.0100.10020.83
5.5.270.0030.10320.74
5.5.260.0100.10020.98
5.5.250.0100.09720.51
5.5.240.0200.09720.27
5.4.450.0170.08319.59
5.4.440.0330.08319.58
5.4.430.0200.08319.25
5.4.420.0230.06019.43
5.4.410.0230.06019.10
5.4.400.0200.04719.09
5.4.390.0170.08019.11
5.4.380.0330.05019.12
5.4.370.0300.04719.10
5.4.360.0270.08018.94
5.4.350.0200.05719.23
5.4.340.0170.05019.10
5.4.320.0400.07019.10
5.4.310.0300.07019.12
5.4.300.0370.06318.87
5.4.290.0230.05718.90
5.4.280.0110.07612.37
5.4.270.0130.08612.37
5.4.260.0050.07912.37
5.4.250.0120.09112.37
5.4.240.0100.09512.37
5.4.230.0090.08612.37
5.4.220.0120.07512.36
5.4.210.0090.06412.37
5.4.200.0080.07612.37
5.4.190.0290.08012.36
5.4.180.0090.05312.36
5.4.170.0090.05512.37
5.4.160.0100.05512.37
5.4.150.0080.05812.37
5.4.140.0080.05412.05
5.4.130.0090.05212.04
5.4.120.0100.04912.01
5.4.110.0050.05112.01
5.4.100.0080.04912.00
5.4.90.0050.05312.00
5.4.80.0070.05112.00
5.4.70.0090.07312.00
5.4.60.0150.10512.00
5.4.50.0090.06412.00
5.4.40.0070.04711.98
5.4.30.0090.06911.98
5.4.20.0120.06711.98
5.4.10.0080.04911.99
5.4.00.0130.05911.46
5.3.290.4470.04714.57
5.3.280.0420.08512.71
5.3.270.0070.06212.72
5.3.260.0080.07512.72
5.3.250.0100.07312.72
5.3.240.0170.10112.71
5.3.230.0180.12612.71
5.3.220.0080.08512.68
5.3.210.0120.07512.68
5.3.200.0100.05712.68
5.3.190.0100.05212.68
5.3.180.0100.05112.67
5.3.170.0070.05212.67
5.3.160.0090.04912.68
5.3.150.0060.05312.68
5.3.140.0070.05112.66
5.3.130.0050.05512.66
5.3.120.0110.05012.66
5.3.110.0080.05312.66
5.3.100.0070.05212.14
5.3.90.0090.04812.11
5.3.80.0050.05112.09
5.3.70.0060.05012.09
5.3.60.0120.04412.08
5.3.50.0060.05712.02
5.3.40.0120.05112.02
5.3.30.0100.05311.98
5.3.20.0130.05211.76
5.3.10.0120.05111.73
5.3.00.0080.05411.71
5.2.170.0120.0479.22
5.2.160.0450.1169.22
5.2.150.0050.0499.21
5.2.140.0070.0579.21
5.2.130.0090.0429.17
5.2.120.0090.0529.18
5.2.110.0100.0609.18
5.2.100.0110.0439.18
5.2.90.0060.0319.17
5.2.80.0070.0339.17
5.2.70.0070.0439.17
5.2.60.0060.0419.13
5.2.50.0100.0429.10
5.2.40.0110.0409.08
5.2.30.0090.0489.06
5.2.20.0070.0429.04
5.2.10.0060.0318.96
5.2.00.0040.0408.82
5.1.60.0060.1718.14
5.1.50.0050.1888.14
5.1.40.0060.1718.12
5.1.30.0070.2098.46
5.1.20.0040.1718.49
5.1.10.0070.1738.22
5.1.00.0060.2648.22
5.0.50.0080.2406.69
5.0.40.0080.2246.55
5.0.30.0080.1596.36
5.0.20.0050.1466.33
5.0.10.0060.1846.31
5.0.00.0090.2316.29
4.4.90.0030.1564.78
4.4.80.0050.2224.75
4.4.70.0060.2074.76
4.4.60.0050.1924.75
4.4.50.0040.1754.77
4.4.40.0070.2614.71
4.4.30.0070.2714.76
4.4.20.0060.2284.84
4.4.10.0090.2764.85
4.4.00.0070.2044.76
4.3.110.0030.1554.67
4.3.100.0090.1774.67
4.3.90.0040.2084.63
4.3.80.0080.1854.61
4.3.70.0040.1264.63
4.3.60.0090.2094.63
4.3.50.0040.2474.63
4.3.40.0040.2204.55
4.3.30.0040.1393.36
4.3.20.0072.4308.19
4.3.10.0032.4308.19
4.3.00.0072.4578.19

preferences:
44.2 ms | 401 KiB | 5 Q