3v4l.org

run code in 300+ PHP versions simultaneously
<?php class keywords { public $ngramsSpecific = array ( 'tos pačios lyties', 'seksualin* mažum*', 'gėj* eityn*' ); public $ngramsGeneric = array ( 'žmogaus teis*' ); public $keywordsSpecific = array ( 'gėjus', 'lesbietė', 'transvestitas', 'homoseksualas', 'biseksualas', 'homoseksualumas', 'homoseksualus', 'pride', 'LGBT', 'homofobija', 'homofobiškas', 'transseksualas', 'LGBTQ', 'DOMA', 'queer' ); public $keywordsGeneric = array ( 'tolerantiškas', 'tolerancija', 'diskriminacija', 'orientacija', 'paradas', 'eitynės', 'neapykanta', 'lygybė', 'mažuma' ); public $positiveAuthors = array ( 'Nida Vasiliauskaitė', 'Artūras Rudomanskis', 'Marija Aušrinė Pavilionienė', 'Mindaugas Kluonis', 'J. V. Daugmaudis' ); public $negativeAuthors = array ( 'Liudvika Pociūnienė', 'Tomas Čyvas', 'Vytautas Sinica', 'Paulius Stonis' ); } function getRelevancy(article $article = null) { $keywords = new keywords(); //$articleBody = strtolower($article->body); $articleBody = "laba diena seksualinė mažuma yra labai geri, bet seksualinės mažumos nėra pats geriausias vaistas nuo visu ligu, nes seksualinėse mažumose gali buti pasitaike daugybe ivairiu dalyku tuo tarpu aseseksualinės mažumos nenori valgyto"; $match = array(); foreach($keywords->ngramsSpecific as $ngram) { //\b(seksualin\w+)\s\b(mazum\w+) $ngram = str_ireplace('*', '\w+', $ngram); $exploded = explode(" ", $ngram); foreach($exploded as &$piece) { $piece = "\b" . $piece; } $regex = "/" . implode("\s", $exploded) . "/iu"; preg_match_all($regex, $articleBody, $matches); $match[] = $matches; } return $match; /* $annotatedTitle = annotateText($article->title); $annotatedBody = annotateText($article->body); $titleIntersection = array_intersect($annotatedTitle, array_map('strtolower', $specificKeywords)); $bodyIntersection = array_intersect($annotatedBody, array_map('strtolower', $specificKeywords)); $titleIntersectionI = array_intersect($annotatedTitle, array_map('strtolower', $genericKeywords)); $bodyIntersectionI = array_intersect($annotatedBody, array_map('strtolower', $genericKeywords)); return array($titleIntersection, $bodyIntersection, $titleIntersectionI, $bodyIntersectionI); */ } print_r(getRelevancy());

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.00318.68
8.3.50.0090.01222.18
8.3.40.0110.00718.92
8.3.30.0190.00318.93
8.3.20.0050.00318.90
8.3.10.0030.00520.83
8.3.00.0040.00423.51
8.2.180.0060.01216.88
8.2.170.0080.00822.96
8.2.160.0030.01020.39
8.2.150.0090.00024.18
8.2.140.0030.00524.66
8.2.130.0000.00826.16
8.2.120.0040.00419.74
8.2.110.0040.00422.21
8.2.100.0000.01618.09
8.2.90.0030.00619.36
8.2.80.0030.00517.97
8.2.70.0050.00317.86
8.2.60.0090.00017.93
8.2.50.0050.00318.10
8.2.40.0110.00020.49
8.2.30.0040.00419.95
8.2.20.0040.00418.03
8.2.10.0040.00418.06
8.2.00.0030.00617.98
8.1.280.0090.00625.92
8.1.270.0080.00023.99
8.1.260.0070.00026.35
8.1.250.0050.00328.09
8.1.240.0090.00321.23
8.1.230.0030.00917.52
8.1.220.0000.00818.00
8.1.210.0030.00618.77
8.1.200.0100.00017.60
8.1.190.0050.00517.78
8.1.180.0000.00818.10
8.1.170.0040.00418.71
8.1.160.0040.00422.07
8.1.150.0060.00318.81
8.1.140.0080.00017.71
8.1.130.0000.00718.00
8.1.120.0040.00417.70
8.1.110.0000.00817.71
8.1.100.0000.00817.63
8.1.90.0040.00417.54
8.1.80.0050.00317.67
8.1.70.0000.00717.54
8.1.60.0030.00517.75
8.1.50.0050.00317.61
8.1.40.0050.00317.77
8.1.30.0050.00317.82
8.1.20.0080.00017.79
8.1.10.0000.00817.75
8.1.00.0040.00417.67
8.0.300.0050.00218.77
8.0.290.0050.00316.73
8.0.280.0000.00818.49
8.0.270.0080.00017.24
8.0.260.0030.00317.12
8.0.250.0000.00817.23
8.0.240.0000.00917.20
8.0.230.0050.00317.13
8.0.220.0030.00317.18
8.0.210.0070.00017.08
8.0.200.0030.00317.13
8.0.190.0040.00417.21
8.0.180.0070.00017.20
8.0.170.0000.00817.20
8.0.160.0000.00817.03
8.0.150.0060.00317.10
8.0.140.0030.00617.13
8.0.130.0030.00313.66
8.0.120.0060.00317.18
8.0.110.0000.00817.25
8.0.100.0050.00217.23
8.0.90.0000.00717.11
8.0.80.0030.01917.25
8.0.70.0030.00517.17
8.0.60.0000.00717.10
8.0.50.0070.00017.03
8.0.30.0090.01117.19
8.0.20.0130.00617.40
8.0.10.0050.00317.30
8.0.00.0110.00916.99
7.4.330.0060.00013.43
7.4.320.0040.00416.89
7.4.300.0060.00016.77
7.4.290.0000.00716.86
7.4.280.0080.00016.90
7.4.270.0030.00316.82
7.4.260.0060.00013.70
7.4.250.0080.00016.95
7.4.240.0000.00716.96
7.4.230.0000.00716.94
7.4.220.0130.01016.89
7.4.210.0060.00916.83
7.4.200.0070.00016.89
7.4.190.0040.00416.57
7.4.160.0100.00616.92
7.4.150.0120.00817.40
7.4.140.0100.01217.86
7.4.130.0040.01316.68
7.4.120.0130.00916.86
7.4.110.0170.00016.78
7.4.100.0070.01717.00
7.4.90.0130.00616.84
7.4.80.0060.01219.37
7.4.70.0090.00616.79
7.4.60.0060.01016.66
7.4.50.0000.00816.45
7.4.40.0150.00322.27
7.4.30.0030.01616.88
7.4.00.0040.01115.36
7.3.330.0030.00313.54
7.3.320.0000.00613.40
7.3.310.0040.00416.42
7.3.300.0000.00716.50
7.3.290.0100.01016.57
7.3.280.0060.01216.58
7.3.270.0070.01317.40
7.3.260.0130.00518.24
7.3.250.0130.00516.72
7.3.240.0070.01116.61
7.3.230.0130.00316.83
7.3.210.0100.00716.57
7.3.200.0030.01619.39
7.3.190.0030.01416.50
7.3.180.0030.01316.74
7.3.170.0080.00816.90
7.3.160.0140.00316.60
7.3.120.0060.01214.98
7.2.330.0150.00316.95
7.2.320.0100.00716.83
7.2.310.0120.00616.85
7.2.300.0100.00716.94
7.2.290.0100.00716.75
7.2.60.0070.00717.00
7.2.50.0040.01117.04
7.1.200.0030.01116.13
7.1.70.0060.01217.14
7.1.60.0160.00919.40
7.1.50.0170.03035.12
7.1.00.0070.04722.38
7.0.200.0050.00316.98
7.0.140.0000.08022.21
7.0.60.0130.07721.69
7.0.50.0030.08021.97
7.0.40.0030.07720.07
7.0.30.0030.08320.11
7.0.20.0030.07719.96
7.0.10.0100.07020.14
7.0.00.0070.08020.17
5.6.210.0300.07020.63
5.6.200.0070.08321.07
5.6.190.0130.06721.16
5.6.180.0100.06320.98
5.6.170.0100.08021.14
5.6.160.0070.07721.00
5.6.150.0030.08721.02
5.6.140.0030.05021.02
5.6.130.0030.08721.06
5.6.120.0000.08721.13
5.6.110.0000.09021.01
5.6.100.0000.08721.00
5.6.90.0030.07721.09
5.6.80.0070.07720.40
5.6.70.0100.05320.39
5.6.60.0030.04020.25
5.6.50.0070.04020.39
5.6.40.0100.03320.34
5.6.30.0000.04320.47
5.6.20.0030.04020.47
5.6.10.0000.03720.41
5.6.00.0030.04720.34
5.5.350.0130.08320.49
5.5.340.0030.07020.82
5.5.330.0000.08020.68
5.5.320.0100.07320.83
5.5.310.0030.08320.86
5.5.300.0070.06020.99
5.5.290.0100.07720.79
5.5.280.0030.05720.98
5.5.270.0100.07020.88
5.5.260.0130.07720.78
5.5.250.0030.05320.60
5.5.240.0030.08020.21
5.5.230.0070.05320.17
5.5.220.0070.03720.27
5.5.210.0070.04020.05
5.5.200.0030.04020.23
5.5.190.0000.04320.09
5.5.180.0000.04320.17
5.5.160.0000.04720.27
5.5.150.0030.03020.11
5.5.140.0030.03720.24
5.5.130.0030.03020.13
5.5.120.0000.03720.12
5.5.110.0000.04020.16
5.5.100.0030.04020.03
5.5.90.0000.03320.23
5.5.80.0000.03319.91
5.5.70.0030.03320.08
5.5.60.0030.03320.21
5.5.50.0030.03020.09
5.5.40.0030.03020.02
5.5.30.0030.03020.14
5.5.20.0000.03719.99
5.5.10.0070.03020.09
5.5.00.0070.04320.09
5.4.450.0070.07719.50
5.4.440.0070.08319.24
5.4.430.0000.07319.39
5.4.420.0030.08019.49
5.4.410.0000.08019.27
5.4.400.0100.07319.05
5.4.390.0070.07019.07
5.4.380.0030.03718.90
5.4.370.0070.03319.12
5.4.360.0000.07719.01
5.4.350.0000.03319.21
5.4.340.0070.04019.08
5.4.320.0000.03319.17
5.4.310.0030.03718.91
5.4.300.0070.04019.12
5.4.290.0000.04319.07
5.4.280.0030.03319.00
5.4.270.0000.03019.08
5.4.260.0030.04319.03
5.4.250.0030.03019.11
5.4.240.0000.05019.04
5.4.230.0070.03018.92
5.4.220.0000.03319.00
5.4.210.0000.03319.11
5.4.200.0070.02719.01
5.4.190.0070.02719.16
5.4.180.0070.02719.16
5.4.170.0070.03319.00
5.4.160.0100.03319.05
5.4.150.0030.03019.20
5.4.140.0000.03316.30
5.4.130.0030.03016.50
5.4.120.0070.03716.47
5.4.110.0030.04016.53
5.4.100.0030.07716.48
5.4.90.0070.03016.52
5.4.80.0030.07016.40
5.4.70.0100.03316.39
5.4.60.0030.04016.32
5.4.50.0100.03316.48
5.4.40.0030.05316.37
5.4.30.0070.03016.33
5.4.20.0030.04016.41
5.4.10.0030.03716.26
5.4.00.0030.03315.89
5.3.290.0030.04014.76
5.3.280.0030.03014.65
5.3.270.0100.02314.58
5.3.260.0000.04714.66
5.3.250.0030.03014.67
5.3.240.0030.03314.71
5.3.230.0100.06314.71
5.3.220.0070.03314.56
5.3.210.0070.04014.55
5.3.200.0070.03714.64
5.3.190.0100.06714.57
5.3.180.0030.04714.68
5.3.170.0000.04014.57
5.3.160.0030.03714.65
5.3.150.0030.03714.62
5.3.140.0030.04014.57
5.3.130.0030.04714.64
5.3.120.0100.05014.62
5.3.110.0030.04014.60
5.3.100.0030.03714.05
5.3.90.0000.04014.09
5.3.80.0070.03314.02
5.3.70.0030.03713.93
5.3.60.0070.07014.02
5.3.50.0070.07013.81
5.3.40.0070.02713.95
5.3.30.0000.06313.98
5.3.20.0170.06313.60
5.3.10.0070.06013.66
5.3.00.0100.06013.70
5.2.170.0000.04711.21
5.2.160.0030.02011.27
5.2.150.0070.04011.00
5.2.140.0000.04711.25
5.2.130.0000.07311.02
5.2.120.0000.04311.12
5.2.110.0000.06011.15
5.2.100.0070.05011.16
5.2.90.0000.06311.10
5.2.80.0000.05711.01
5.2.70.0030.06011.17
5.2.60.0000.05011.04
5.2.50.0070.06011.09
5.2.40.0000.06311.06
5.2.30.0030.06311.03
5.2.20.0000.05011.02
5.2.10.0070.04310.92
5.2.00.0030.06310.78
5.1.60.0000.04710.46
5.1.50.0070.04010.46
5.1.40.0030.04710.46
5.1.30.0000.04310.46
5.1.20.0000.03010.46
5.1.10.0030.05710.46
5.1.00.0030.05310.46
5.0.50.0030.04710.46
5.0.40.0070.04010.46
5.0.30.0000.07010.46
5.0.20.0030.04010.46
5.0.10.0030.04310.46
5.0.00.0030.06310.46
4.4.90.0030.02710.46
4.4.80.0030.03310.46
4.4.70.0030.03010.46
4.4.60.0070.03010.46
4.4.50.0000.03710.46
4.4.40.0070.05010.46
4.4.30.0070.03310.46
4.4.20.0000.02710.46
4.4.10.0000.01710.46
4.4.00.0000.05710.46
4.3.110.0000.03710.46
4.3.100.0000.03310.46
4.3.90.0000.03710.46
4.3.80.0000.05310.46
4.3.70.0030.03010.46
4.3.60.0000.03710.46
4.3.50.0000.03710.46
4.3.40.0000.04310.46
4.3.30.0000.03310.46
4.3.20.0000.04010.46
4.3.10.0030.03310.46
4.3.00.0030.03310.46

preferences:
41.63 ms | 401 KiB | 5 Q