3v4l.org

run code in 300+ PHP versions simultaneously
<?php class TranslationError extends \Exception { public function __construct(string $message){ parent::__construct($message); } } class TranslationUtils { /** * List of strings that are required to be in the translation if they appear in the english one */ private const MANDATORY_MATCHES = ['/…/', '/%(\\d+\$)?(b|B|h|H|s|S|c|C|d|i|x|X|e|E|f|g|G|a|A|t|T|n)/']; public static function checkTranslation(string $original, string $translation){ //CHECK MANDATORY STRINGS foreach(static::MANDATORY_MATCHES as $pattern){ $matches = []; if(preg_match_all($pattern, $original, $matches) >= 1){ foreach($matches[0] as $match){ if(strpos($translation, $match) === FALSE){ throw new TranslationError("Missing '" . $match . "' from translation!"); } } } } } public static function isTranslationOk(string $original, string $translation) : bool { try { TranslationUtils::checkTranslation("Loading…", "adsda..."); return true; } catch(TranslationError $ex){ var_dump($ex->getMessage()); return false; } } } var_dump(TranslationUtils::isTranslationOk("Loading…", "adsda...")); var_dump(TranslationUtils::isTranslationOk("Loading…", "adsda…")); var_dump(TranslationUtils::isTranslationOk("Ciao %s", "Ciao %s")); var_dump(TranslationUtils::isTranslationOk("NOPE %d", "YES %s")); var_dump(TranslationUtils::isTranslationOk("Allo %\$1s", "Hello %\$1s %\$2s")); var_dump(TranslationUtils::isTranslationOk("Loading…", "adsda...")); var_dump(TranslationUtils::isTranslationOk("Loading…", "adsda...")); var_dump(TranslationUtils::isTranslationOk("Loading…", "adsda..."));

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.0070.01118.43
8.3.50.0190.00018.16
8.3.40.0120.00618.92
8.3.30.0120.00319.09
8.3.20.0030.00521.90
8.3.10.0050.00322.05
8.3.00.0040.00419.79
8.2.180.0100.01018.55
8.2.170.0140.00722.96
8.2.160.0040.01122.17
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00018.34
8.2.120.0050.00326.35
8.2.110.0090.00020.32
8.2.100.0070.00419.18
8.2.90.0080.00019.34
8.2.80.0030.00617.97
8.2.70.0000.00818.13
8.2.60.0060.00318.05
8.2.50.0080.00018.10
8.2.40.0000.00820.52
8.2.30.0040.00419.27
8.2.20.0040.00418.11
8.2.10.0030.00518.19
8.2.00.0040.00417.95
8.1.280.0160.00625.92
8.1.270.0000.00821.90
8.1.260.0030.00526.35
8.1.250.0050.00328.09
8.1.240.0040.00722.19
8.1.230.0040.00821.15
8.1.220.0050.00317.91
8.1.210.0000.00818.77
8.1.200.0040.00817.63
8.1.190.0030.00617.38
8.1.180.0030.00518.10
8.1.170.0040.00418.91
8.1.160.0000.00718.87
8.1.150.0070.00022.07
8.1.140.0040.00419.62
8.1.130.0030.00319.13
8.1.120.0000.00817.66
8.1.110.0000.00817.68
8.1.100.0000.00717.67
8.1.90.0040.00417.59
8.1.80.0050.00217.55
8.1.70.0030.00317.60
8.1.60.0040.00417.64
8.1.50.0000.00817.74
8.1.40.0030.00517.75
8.1.30.0000.00817.71
8.1.20.0030.00517.82
8.1.10.0040.00417.77
8.1.00.0000.00817.76
8.0.300.0000.00718.77
8.0.290.0030.00616.88
8.0.280.0000.00718.52
8.0.270.0040.00417.38
8.0.260.0000.00617.38
8.0.250.0030.00317.08
8.0.240.0000.00717.25
8.0.230.0040.00417.20
8.0.220.0040.00417.15
8.0.210.0040.00417.17
8.0.200.0030.00317.21
8.0.190.0040.00417.20
8.0.180.0040.00417.07
8.0.170.0040.00417.24
8.0.160.0030.00517.17
8.0.150.0050.00217.15
8.0.140.0040.00417.01
8.0.130.0050.00513.58
8.0.120.0040.00417.03
8.0.110.0000.00716.98
8.0.100.0050.00317.16
8.0.90.0080.00017.02
8.0.80.0100.01317.04
8.0.70.0040.00417.22
8.0.60.0000.00716.99
8.0.50.0070.00017.22
8.0.30.0110.00817.31
8.0.20.0120.01117.40
8.0.10.0080.00017.32
8.0.00.0070.01117.13
7.4.330.0000.00515.55
7.4.320.0000.00716.83
7.4.300.0030.00316.77
7.4.290.0020.00516.91
7.4.280.0090.00016.82
7.4.270.0030.00316.76
7.4.260.0040.00416.75
7.4.250.0030.00316.64
7.4.240.0030.00616.79
7.4.230.0040.00416.85
7.4.220.0140.00316.70
7.4.210.0120.00316.91
7.4.200.0000.00716.75
7.4.160.0090.00716.77
7.4.150.0070.01017.40
7.4.140.0090.00917.86
7.4.130.0120.00716.69
7.4.120.0110.00916.73
7.4.110.0110.00716.69
7.4.100.0090.01216.86
7.4.90.0130.00716.93
7.4.80.0070.01119.39
7.4.70.0030.01416.71
7.4.60.0040.01416.91
7.4.50.0030.01216.59
7.4.40.0200.00016.81
7.4.30.0100.00716.69
7.4.00.0030.01015.09
7.3.330.0030.00313.39
7.3.320.0030.00313.54
7.3.310.0070.00016.57
7.3.300.0000.00816.66
7.3.290.0090.00916.53
7.3.280.0110.00716.53
7.3.270.0090.00917.40
7.3.260.0130.01016.59
7.3.250.0080.01116.64
7.3.240.0110.00816.76
7.3.230.0120.01216.75
7.3.210.0040.01216.63
7.3.200.0100.01016.57
7.3.190.0150.00016.79
7.3.180.0020.01416.70
7.3.170.0100.00716.64
7.3.160.0100.00616.70
7.3.10.0090.00916.52
7.3.00.0160.00616.50
7.2.330.0100.00916.82
7.2.320.0140.00316.90
7.2.310.0120.00616.82
7.2.300.0130.00716.99
7.2.290.0090.00816.80
7.2.130.0140.00716.57
7.2.120.0090.00916.49
7.2.110.0140.00416.61
7.2.100.0170.00316.57
7.2.90.0190.01217.18
7.2.80.0120.00916.80
7.2.70.0070.01416.64
7.2.60.0140.00917.13
7.2.50.0110.00516.70
7.2.40.0170.00516.62
7.2.30.0180.00916.35
7.2.20.0100.01016.43
7.2.10.0250.00416.69
7.2.00.0100.01018.32
7.1.250.0150.01015.64
7.1.200.0040.00416.08
7.1.70.0000.00817.44
7.1.60.0090.00617.38
7.1.50.0000.01117.40
7.1.10.0070.06722.26
7.1.00.0200.06722.29
7.0.200.0070.01016.46
7.0.150.0100.06721.99
7.0.140.0100.05721.94
7.0.130.0100.07721.87
7.0.120.0100.07721.84
7.0.110.0070.08021.79
7.0.100.0100.05721.82
7.0.90.0130.05721.89
7.0.80.0130.06721.92
7.0.70.0070.06321.85
7.0.60.0130.07721.98
7.0.50.0070.05722.04
7.0.40.0030.06021.96
7.0.30.0130.06721.93
7.0.20.0070.05321.83
7.0.10.0030.06321.86
7.0.00.0100.05321.86

preferences:
79.11 ms | 401 KiB | 5 Q