3v4l.org

run code in 300+ PHP versions simultaneously
<?php function esc_url($string) { return $string; // just preventing demo breakage } function get_term_link($wpObject) { return 'https://www.example.com/' . $wpObject->slug; } $tipologiaTerms = [ (object) ['term_id' => 1, 'name' => 'racconti sulla vita', 'slug' => 'racconti-sulla-vita', 'taxonomy' => 'category'], (object) ['term_id' => 2, 'name' => 'racconti di passione', 'slug' => 'racconti-di-passione', 'taxonomy' => 'category'], (object) ['term_id' => 3, 'name' => 'sulle amotivazionali', 'slug' => 'sulle-amotivazionali', 'taxonomy' => 'category'], (object) ['term_id' => 4, 'name' => 'boem sulle', 'slug' => 'boem-sulle', 'taxonomy' => 'category'], (object) ['term_id' => 5, 'name' => 'racconti sui pensieri', 'slug' => 'racconti-sui-pensieri', 'taxonomy' => 'category'], (object) ['term_id' => 6, 'name' => 'racconti motivazionali', 'slug' => 'racconti-motivazionali', 'taxonomy' => 'category'], ]; $blacklist = ["racconti", "sul", "sull'", "sulla", "sulle", "sullo", "sui", "di"]; $pattern = '/\b(?:' . implode('|', $blacklist) . ')\b\s?/i'; $cleanNames = []; foreach ($tipologiaTerms as $wpTerm) { $wpTerm->name = rtrim(preg_replace($pattern, '', $wpTerm->name)); $cleanNames[] = $wpTerm->name; } array_multisort($cleanNames, $tipologiaTerms); foreach ($tipologiaTerms as $wpTerm) { printf( '<li><a href="%s">%s</a></li>' . "\n", esc_url(get_term_link($wpTerm)), $wpTerm->name ); }

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.10.0080.00417.07
8.5.00.0120.00920.18
8.4.150.0020.00014.05
8.4.140.0130.00817.87
8.4.130.0130.00718.67
8.4.120.0110.00824.01
8.4.110.0130.00718.82
8.4.100.0080.00620.84
8.4.90.0080.01220.52
8.4.80.0060.00518.61
8.4.70.0070.01518.27
8.4.60.0100.00918.80
8.4.50.0080.01218.96
8.4.40.0090.01218.14
8.4.30.0150.00420.39
8.4.20.0080.00020.09
8.4.10.0030.00619.62
8.3.280.0150.01318.50
8.3.270.0130.00716.65
8.3.260.0130.00616.70
8.3.250.0100.00918.96
8.3.240.0120.00717.08
8.3.230.0130.00616.63
8.3.220.0090.00918.98
8.3.210.0110.00916.93
8.3.200.0070.00216.67
8.3.190.0150.00518.97
8.3.180.0030.00517.04
8.3.170.0130.00620.66
8.3.160.0110.00716.97
8.3.150.0090.00918.90
8.3.140.0050.00316.89
8.3.130.0090.00018.54
8.3.120.0090.00619.30
8.3.110.0110.00420.94
8.3.100.0030.00624.06
8.3.90.0000.00826.77
8.3.80.0090.00017.97
8.3.70.0150.00018.33
8.3.60.0100.01018.55
8.3.50.0060.00916.84
8.3.40.0070.00723.57
8.3.30.0080.00819.13
8.3.20.0080.00024.18
8.3.10.0040.00424.66
8.3.00.0080.00026.16
8.2.290.0100.00920.41
8.2.280.0080.00818.52
8.2.270.0130.00717.12
8.2.260.0040.00717.02
8.2.250.0080.00016.95
8.2.240.0120.00418.96
8.2.230.0030.00622.58
8.2.220.0000.01637.54
8.2.210.0080.01126.77
8.2.200.0110.00018.79
8.2.190.0110.00716.75
8.2.180.0060.00916.75
8.2.170.0090.00619.04
8.2.160.0070.00722.96
8.2.150.0000.00825.66
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00419.75
8.2.110.0070.00322.33
8.2.100.0320.00318.44
8.2.90.0310.00318.44
8.2.80.0260.00618.44
8.2.70.0290.00318.44
8.2.60.0250.00518.44
8.2.50.0270.00718.44
8.2.40.0190.01418.44
8.2.30.0240.00418.44
8.2.20.0180.00718.44
8.2.10.0240.00518.44
8.2.00.0210.00518.44
8.1.330.0140.00422.07
8.1.320.0040.00417.99
8.1.310.0080.00016.71
8.1.300.0090.00016.64
8.1.290.0070.00430.84
8.1.280.0120.00625.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0000.00928.09
8.1.240.0030.00623.97
8.1.230.0240.00318.44
8.1.220.0250.00318.44
8.1.210.0230.00418.44
8.1.200.0150.01218.44
8.1.190.0230.00318.44
8.1.180.0230.00418.44
8.1.170.0130.01318.44
8.1.160.0260.00018.44
8.1.150.0230.00518.44
8.1.140.0230.00318.44
8.1.130.0210.00818.44
8.1.120.0260.00018.44
8.1.110.0170.01018.44
8.1.100.0250.00418.44
8.1.90.0260.01018.44
8.1.80.0290.00018.44
8.1.70.0180.00918.44
8.1.60.0220.00418.44
8.1.50.0220.00418.44
8.1.40.0160.01218.44
8.1.30.0210.00718.44
8.1.20.0190.00919.30
8.1.10.0250.00318.44
8.1.00.0160.00818.44
8.0.300.0190.00718.44
8.0.290.0230.00318.44
8.0.280.0180.01018.44
8.0.270.0180.01018.44
8.0.260.0160.01218.44
8.0.250.0180.00918.44
8.0.240.0230.00318.44
8.0.230.0300.00018.44
8.0.220.0260.00318.44
8.0.210.0240.00618.44
8.0.200.0280.00618.44
8.0.190.0230.00818.44
8.0.180.0290.00318.44
8.0.170.0290.00318.44
8.0.160.0220.00718.44
8.0.150.0290.00018.44
8.0.140.0250.01018.44
8.0.130.0170.01018.44
8.0.120.0280.00318.44
8.0.110.0250.00418.44
8.0.100.0260.00418.44
8.0.90.0200.01018.44
8.0.80.0230.00318.44
8.0.70.0160.01218.44
8.0.60.0180.01318.44
8.0.50.0120.01018.44
8.0.30.0250.00418.44
8.0.20.0130.00918.44
8.0.10.0230.00018.44

preferences:
91.3 ms | 403 KiB | 5 Q