3v4l.org

run code in 300+ PHP versions simultaneously
<?php $posts['Author1']=['sdsadsad daSDA DDASd asd aSD Sd dA SD ASD sadasdasds sadasd @jhsad.sadas.com sdsdADSA sada', 'KDJKLFFD GFDGFDHGF GFHGFDHGFH GFHFGH Lklfgfd gdfsgfdsg df gfdhgf g hfghghjh jhg @jhsad.sadas.com sfgff fsdfdsf', 'jhjkfsdg fdgdf sfds hgfj j kkjjfghgkjf hdkjtkj lfdjfg hkgfl @jhsad.sadas.com dsfjdshflkds kg lsfdkg;fdgl']; $posts['Author2']=['This is some random string representative of non-signature text. This is the *author\'s* signature.', 'Different message body text. This is the *author\'s* signature. This is an afterthought that expresses that a signature is not always at the end.', 'Finally, this is unwanted stuff. This is the *author\'s* signature.']; foreach($posts as $author=>$texts){ echo "Author: $author\n"; usort($texts,function($a,$b){return strlen($a)-strlen($b);}); // sort ASC by strlen; mb_strlen probably isn't advantageous var_export($texts); echo "\n"; foreach($texts as $index=>$string){ if(!$index){ $overlaps=preg_split('/\s+/',$string,NULL,PREG_SPLIT_NO_EMPTY); // declare with all non-white-space substrings from first text }else{ $overlaps=array_intersect($overlaps,preg_split('/\s+/',$string,NULL,PREG_SPLIT_NO_EMPTY)); // filter word bank using narrowing number of words } } var_export($overlaps); echo "\n"; // batch consecutive substrings $group=null; $consecutives=[]; // clear previous iteration's data foreach($overlaps as $i=>$word){ if($group===null || $i-$last>1){ $group=$i; } $last=$i; $consecutives[$group][]=$word; } var_export($consecutives); echo "\n"; foreach($consecutives as $words){ // match potential signatures in first text for measurement: if(preg_match_all('/\Q'.implode('\E\s+\Q',$words).'\E/',$texts[0],$out)){ // make alternatives characters literal using \Q & \E $potential_signatures=$out[0]; } } usort($potential_signatures,function($a,$b){return strlen($b)-strlen($a);}); // sort DESC by strlen; mb_strlen probably isn't advantageous echo "Assumed Signature: {$potential_signatures[0]}\n\n"; }

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.31
8.4.150.0030.00014.05
8.4.140.0110.01017.98
8.4.130.0040.00717.92
8.4.120.0040.00422.52
8.4.110.0110.01022.34
8.4.100.0130.00918.21
8.4.90.0140.00818.30
8.4.80.0120.00719.92
8.4.70.0080.00719.86
8.4.60.0050.00419.82
8.4.50.0070.01418.87
8.4.40.0090.01219.99
8.4.30.0060.00918.04
8.4.20.0140.00719.87
8.4.10.0050.00519.91
8.3.280.0120.01018.61
8.3.270.0140.00617.00
8.3.260.0120.00816.83
8.3.250.0110.00918.92
8.3.240.0130.00716.71
8.3.230.0130.00616.71
8.3.220.0140.00516.94
8.3.210.0100.01016.99
8.3.200.0130.00717.04
8.3.190.0150.00417.05
8.3.180.0120.00717.32
8.3.170.0150.00320.57
8.3.160.0120.00318.72
8.3.150.0090.00917.27
8.3.140.0110.00816.96
8.3.130.0060.00318.75
8.3.120.0030.00620.92
8.3.110.0100.01316.88
8.3.100.0060.00324.06
8.3.90.0060.00626.77
8.3.80.0060.00317.97
8.3.70.0080.00818.52
8.3.60.0170.00317.00
8.3.50.0070.00917.52
8.3.40.0110.00419.04
8.3.30.0040.01118.92
8.3.20.0040.00420.43
8.3.10.0050.00323.53
8.3.00.0080.00021.69
8.2.290.0120.00720.32
8.2.280.0110.00916.59
8.2.270.0070.01317.31
8.2.260.0100.01018.64
8.2.250.0000.00816.99
8.2.240.0070.00417.36
8.2.230.0040.00420.94
8.2.220.0060.00337.54
8.2.210.0130.00626.77
8.2.200.0070.00716.88
8.2.190.0160.00316.75
8.2.180.0120.00916.75
8.2.170.0110.01122.96
8.2.160.0070.00719.46
8.2.150.0080.00025.66
8.2.140.0090.00024.66
8.2.130.0040.00422.21
8.2.120.0040.00426.35
8.2.110.0090.00919.21
8.2.100.0060.00618.16
8.2.90.0030.00620.07
8.2.80.0040.00417.97
8.2.70.0080.00017.93
8.2.60.0030.00618.16
8.2.50.0000.00818.16
8.2.40.0030.00620.60
8.2.30.0050.00321.04
8.2.20.0000.00718.25
8.2.10.0040.00418.14
8.2.00.0060.00318.23
8.1.330.0140.00423.63
8.1.320.0110.01016.81
8.1.310.0000.00918.59
8.1.300.0120.00620.25
8.1.290.0090.00030.84
8.1.280.0120.01225.92
8.1.270.0060.00323.84
8.1.260.0000.00826.35
8.1.250.0090.00628.09
8.1.240.0030.00719.45
8.1.230.0040.00719.14
8.1.220.0050.00317.74
8.1.210.0100.00018.77
8.1.200.0090.00017.60
8.1.190.0000.00817.60
8.1.180.0080.00018.10
8.1.170.0050.00318.88
8.1.160.0000.00818.85
8.1.150.0000.00819.01
8.1.140.0020.00517.64
8.1.130.0000.00718.99
8.1.120.0040.00417.58
8.1.110.0040.00417.65
8.1.100.0030.00517.63
8.1.90.0000.00717.54
8.1.80.0000.00717.63
8.1.70.0040.00417.61
8.1.60.0060.00317.72
8.1.50.0040.00417.63
8.1.40.0030.00617.69
8.1.30.0040.00417.77
8.1.20.0040.00417.82
8.1.10.0030.00617.75
8.1.00.0000.00817.68
8.0.300.0080.00019.74
8.0.290.0000.00816.88
8.0.280.0050.00318.46
8.0.270.0040.00417.01
8.0.260.0040.00416.88
8.0.250.0030.00517.14
8.0.240.0050.00317.16
8.0.230.0040.00417.06
8.0.220.0030.00316.99
8.0.210.0040.00417.08
8.0.200.0000.00717.02
8.0.190.0030.00517.10
8.0.180.0040.00417.09
8.0.170.0000.00816.99
8.0.160.0000.00716.99
8.0.150.0000.00717.06
8.0.140.0030.00516.93
8.0.130.0030.00613.52
8.0.120.0090.00017.04
8.0.110.0050.00316.96
8.0.100.0050.00316.97
8.0.90.0000.00717.12
8.0.80.0170.00017.09
8.0.70.0000.00717.07
8.0.60.0000.00817.00
8.0.50.0030.00517.08
8.0.30.0120.00717.45
8.0.20.0140.00817.44
8.0.10.0080.00017.23
8.0.00.0090.01516.77
7.4.330.0030.00316.72
7.4.320.0030.00316.77
7.4.300.0060.00016.86
7.4.290.0070.00016.75
7.4.280.0000.00716.71
7.4.270.0040.00416.76
7.4.260.0000.00716.76
7.4.250.0080.00016.71
7.4.240.0030.00316.85
7.4.230.0040.00416.70
7.4.220.0150.00316.80
7.4.210.0040.01216.81
7.4.200.0040.00416.74
7.4.160.0150.00316.85
7.4.150.0100.01017.40
7.4.140.0120.00917.86
7.4.130.0090.00916.56
7.4.120.0090.00916.70
7.4.110.0040.01316.84
7.4.100.0110.00616.82
7.4.90.0170.00716.81
7.4.80.0000.01819.39
7.4.70.0120.00616.85
7.4.60.0000.01716.65
7.4.50.0060.00516.84
7.4.40.0060.01216.68
7.4.30.0080.00816.69
7.4.00.0060.00915.13
7.3.330.0060.00013.61
7.3.320.0030.00313.54
7.3.310.0000.00716.44
7.3.300.0040.00416.43
7.3.290.0060.01116.56
7.3.280.0070.01016.54
7.3.270.0030.01417.40
7.3.260.0120.00816.71
7.3.250.0100.00916.57
7.3.240.0080.01016.63
7.3.230.0040.01316.68
7.3.210.0030.01416.79
7.3.200.0040.01216.78
7.3.190.0080.00816.49
7.3.180.0060.01616.48
7.3.170.0040.01216.55
7.3.160.0100.00716.90
7.3.120.0150.00414.82
7.3.110.0070.01115.03
7.3.100.0060.00915.07
7.3.90.0130.00315.00
7.3.80.0060.00614.99
7.3.70.0030.00714.82
7.3.60.0090.00315.18
7.3.50.0000.00814.99
7.3.40.0120.00615.08
7.3.30.0100.00315.04
7.3.20.0120.00016.64
7.3.10.0090.00316.81
7.3.00.0070.00716.72
7.2.330.0140.00416.70
7.2.320.0140.00316.89
7.2.310.0000.01816.88
7.2.300.0080.00917.02
7.2.290.0120.00616.80
7.2.250.0030.01515.48
7.2.240.0040.01215.15
7.2.230.0090.00615.48
7.2.220.0100.01014.90
7.2.210.0120.00615.33
7.2.200.0060.00615.24
7.2.190.0090.00615.32
7.2.180.0040.01114.98
7.2.170.0060.00915.08
7.2.60.0030.00916.98
7.1.330.0000.01615.93
7.1.320.0000.01515.95
7.1.310.0090.00615.91
7.1.300.0000.01315.96
7.1.290.0000.01115.92
7.1.280.0000.01016.13
7.1.270.0110.00315.89
7.1.260.0030.01016.07
7.1.200.0030.01315.84
7.1.110.0070.00718.34
7.1.100.0070.00718.23
7.1.90.0100.01018.61
7.1.80.0050.00918.61
7.1.70.0040.00917.46
7.1.60.0160.01235.33
7.1.50.0150.01234.93
7.1.40.0070.02334.72
7.1.30.0200.02034.73
7.1.20.0230.01734.83
7.1.10.0120.00617.02
7.1.00.0050.00816.98
7.0.250.0030.01018.05
7.0.240.0030.01017.87
7.0.230.0080.01218.14
7.0.220.0060.00918.09
7.0.210.0030.01416.81
7.0.200.0000.01316.67
7.0.190.0030.01016.74
7.0.180.0060.00916.41
7.0.170.0070.01416.38
7.0.160.0070.00716.36
7.0.150.0050.01016.38
7.0.140.0090.00616.51
7.0.130.0030.00916.79
7.0.120.0070.00716.79
7.0.110.0030.01016.78
7.0.100.0060.00816.50
7.0.90.0030.00916.36
7.0.80.0030.01216.54
7.0.70.0050.00816.70
7.0.60.0090.00616.44
7.0.50.0090.00616.47
7.0.40.0140.00016.86
7.0.30.0030.01016.59
7.0.20.0030.01016.55
7.0.10.0070.01116.70
7.0.00.0070.01116.51

preferences:
32.62 ms | 403 KiB | 5 Q