3v4l.org

run code in 300+ PHP versions simultaneously
<?php function escape_possible($chaines, $sepChmp, $dlmtTxt) { $escape_possible = []; if( preg_match_all("#((?<![$dlmtTxt])$dlmtTxt(?!$dlmtTxt)).*?(?1)#su", $chaines, $encadres) ) { foreach( $encadres[0] as $encadre) { if( preg_match_all("#.(?=$sepChmp)#su", $encadre, $escapes) ) { foreach($escapes[0] as $escape) { if(isset($escape_possible[$escape])) $escape_possible[$escape]++; else $escape_possible[$escape] = 1; } } } } arsort($escape_possible); return $escape_possible; } // cas 1 $sepChmp = ';'; $dlmtTxt = '"'; $chaines = '"il a dit ""aie"" ; en criant" "Laurent TOGIER";"19\; Rue Bréa";75006;PARIS Laurent TOGIER;"\; Rue Bréa";75006;PARIS Laurent TOGIER;"19\;";75006;PARIS Laurent TOGIER;"\;";75006;PARIS Laurent TOGIER;"19\; Rue\; Bréa";75006;PARIS Laurent TOGIER;"\;\;";75006;PARIS'; var_dump(escape_possible($chaines, $sepChmp, $dlmtTxt)); /* array(2) { ["\"]=> int(8) [" "]=> int(1) } */ // cas 2 $sepChmp = '§'; // utf-8 $dlmtTxt = '`'; $chaines = '`Laurent TOGIER`§`19/§ Rue Bréa`§75006§PARIS Laurent TOGIER§`/§ Rue Bréa`§75006§PARIS Laurent TOGIER§`19/§`§75006§PARIS Laurent TOGIER§`/§`§75006§PARIS Laurent TOGIER§`19/§ Rue/§ Bréa`§75006§PARIS Laurent TOGIER§`/§/§`§75006§PARIS `il a dit ``aie`` § en criant`'; var_dump(escape_possible($chaines, $sepChmp, $dlmtTxt)); /* array(2) { ["/"]=> int(8) [" "]=> int(1) } */

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.5.00.0160.00720.27
8.4.150.0030.00014.05
8.4.140.0140.00717.96
8.4.130.0150.00518.03
8.4.120.0060.00320.89
8.4.110.0140.00718.66
8.4.100.0100.00817.97
8.4.90.0120.00818.03
8.4.80.0070.00417.92
8.4.70.0090.01218.16
8.4.60.0100.00718.80
8.4.50.0100.00723.96
8.4.40.0140.00719.80
8.4.30.0060.01024.15
8.4.20.0120.00920.54
8.4.10.0070.01318.01
8.3.280.0080.01218.60
8.3.270.0130.00716.63
8.3.260.0120.00816.89
8.3.250.0080.00720.61
8.3.240.0100.01016.73
8.3.230.0050.00517.13
8.3.220.0120.00718.55
8.3.210.0110.00816.91
8.3.200.0050.00416.79
8.3.190.0080.00717.42
8.3.180.0040.00418.40
8.3.170.0130.00619.01
8.3.160.0150.00316.94
8.3.150.0130.00620.58
8.3.140.0170.00016.72
8.3.130.0090.00616.91
8.3.120.0110.01118.95
8.3.110.0150.00320.94
8.3.100.0000.00924.06
8.3.90.0150.00026.77
8.3.80.0060.00317.00
8.3.70.0150.00316.63
8.3.60.0150.00618.68
8.3.50.0090.00918.58
8.3.40.0150.00018.90
8.3.30.0050.01019.10
8.3.20.0050.00221.03
8.3.10.0070.00023.56
8.3.00.0030.00520.95
8.2.290.0050.00418.90
8.2.280.0110.00918.20
8.2.270.0150.00417.27
8.2.260.0000.00818.89
8.2.250.0050.00318.75
8.2.240.0030.00717.16
8.2.230.0090.00022.58
8.2.220.0040.01537.54
8.2.210.0030.00626.77
8.2.200.0090.00316.63
8.2.190.0030.01916.63
8.2.180.0110.00718.31
8.2.170.0040.01122.96
8.2.160.0120.00620.60
8.2.150.0030.00625.66
8.2.140.0040.00424.66
8.2.130.0080.00018.34
8.2.120.0070.00026.35
8.2.110.0000.00919.43
8.2.100.0100.00318.16
8.2.90.0040.00418.16
8.2.80.0000.00918.18
8.2.70.0030.00618.05
8.2.60.0000.00918.09
8.2.50.0060.00318.10
8.2.40.0040.00419.38
8.2.30.0040.00419.29
8.2.20.0070.00018.22
8.2.10.0040.00419.45
8.2.00.0040.00418.11
8.1.330.0100.00918.37
8.1.320.0080.01216.62
8.1.310.0150.00016.64
8.1.300.0040.00417.11
8.1.290.0000.01018.88
8.1.280.0070.01525.92
8.1.270.0000.00820.38
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0060.00323.86
8.1.230.0070.00421.09
8.1.220.0050.00317.89
8.1.210.0050.00518.84
8.1.200.0000.01217.60
8.1.190.0040.00417.38
8.1.180.0040.00418.10
8.1.170.0050.00318.79
8.1.160.0000.00718.89
8.1.150.0070.00018.93
8.1.140.0070.00018.97
8.1.130.0000.00820.36
8.1.120.0000.00717.68
8.1.110.0000.00817.61
8.1.100.0030.00717.72
8.1.90.0000.00817.70
8.1.80.0030.00717.54
8.1.70.0040.00417.62
8.1.60.0000.00817.80
8.1.50.0000.00817.61
8.1.40.0030.00617.65
8.1.30.0040.00417.87
8.1.20.0040.00417.82
8.1.10.0040.00417.75
8.1.00.0030.00617.66
8.0.300.0070.00020.04
8.0.290.0050.00317.13
8.0.280.0030.00318.43
8.0.270.0030.00317.33
8.0.260.0000.00618.44
8.0.250.0070.00017.11
8.0.240.0000.00817.08
8.0.230.0030.00317.24
8.0.220.0000.00717.19
8.0.210.0000.00717.08
8.0.200.0000.00717.21
8.0.190.0040.00417.19
8.0.180.0040.00417.16
8.0.170.0000.00817.10
8.0.160.0040.00417.05
8.0.150.0040.00417.13
8.0.140.0030.00717.11
8.0.130.0030.00313.59
8.0.120.0040.00417.18
8.0.110.0020.00517.15
8.0.100.0000.00717.07
8.0.90.0000.00817.05
8.0.80.0190.00317.16
8.0.70.0070.00016.95
8.0.60.0000.00817.17
8.0.50.0000.00717.02
8.0.30.0180.00317.23
8.0.20.0090.01017.41
8.0.10.0040.00417.19
8.0.00.0110.00917.04
7.4.330.0000.00516.75
7.4.320.0030.00316.60
7.4.300.0000.00616.84
7.4.290.0030.00316.83
7.4.280.0080.00016.74
7.4.270.0000.00816.66
7.4.260.0000.00716.63
7.4.250.0050.00316.63
7.4.240.0070.00016.72
7.4.230.0000.00716.91
7.4.220.0040.00416.90
7.4.210.0120.00616.83
7.4.200.0030.00317.00
7.4.160.0090.01016.84
7.4.130.0170.00816.94
7.4.120.0110.00716.63
7.4.110.0130.01016.68
7.4.100.0070.01416.74
7.4.90.0120.00416.91
7.4.80.0060.01319.39
7.4.70.0070.01316.71
7.4.60.0060.00916.65
7.4.50.0070.01016.55
7.4.40.0040.01416.52
7.4.00.0090.00315.10
7.3.330.0000.00513.54
7.3.320.0000.00613.41
7.3.310.0070.00016.41
7.3.300.0060.00316.50
7.3.290.0070.00016.61
7.3.280.0150.00516.57
7.3.260.0090.01116.71
7.3.240.0110.00616.80
7.3.230.0180.00716.73
7.3.210.0070.01016.90
7.3.200.0090.00916.42
7.3.190.0120.00416.73
7.3.180.0100.00716.57
7.3.170.0090.01316.81
7.3.160.0090.01216.86
7.3.40.0100.00314.84
7.3.30.0120.00615.08
7.3.20.0080.00616.79
7.3.10.0040.01916.76
7.3.00.0060.00816.60
7.2.330.0040.01316.85
7.2.320.0120.00616.95
7.2.310.0000.02116.95
7.2.300.0000.01716.80
7.2.290.0090.01216.80
7.2.170.0030.02015.14
7.2.160.0090.00315.28
7.2.150.0040.01117.13
7.2.140.0090.00617.06
7.2.130.0070.00717.17
7.2.120.0030.01217.03
7.2.110.0050.01017.08
7.2.100.0060.00917.05
7.2.90.0120.00317.17
7.2.80.0000.01517.21
7.2.70.0060.00917.13
7.2.60.0090.00617.21
7.2.50.0140.00016.88
7.2.40.0070.00717.17
7.2.30.0070.00717.28
7.2.20.0050.00917.16
7.2.10.0100.00317.02
7.2.00.0090.00317.29
7.1.280.0140.01015.85
7.1.270.0000.01416.16
7.1.260.0030.01015.89
7.1.250.0100.00316.04

preferences:
35.99 ms | 403 KiB | 5 Q