3v4l.org

run code in 300+ PHP versions simultaneously
<?php class String extends StringHelper { public function interpolate($str, array $context = [], $asIs = false) { $replace = []; foreach ($context as $key => $val) { if ($asIs) { $replace[$key] = $val; } else { $replace['{{' . $key . '}}'] = $val; } } return strtr($str, $replace); } } class CacheKeysDict { protected static $stringHelper = null; const BOT_ACTIVITY_MESSAGES = 'bot_activity_messages'; const PROFILE = 'profile_{{id}}'; public static function prepareKey($id, array $context = []) { $key = constant("CacheKeysDict::{$id}"); return self::getStringHelper()->interpolate($key, $context); } public static function getStringHelper() { if (is_null(self::$stringHelper)) { self::$stringHelper = new \common\helpers\String; } return self::$stringHelper; } } var_dump([ CacheKeysDict::BOT_ACTIVITY_MESSAGES, CacheKeysDict::prepareKey(CacheKeysDict::BOT_ACTIVITY_MESSAGES), CacheKeysDict::prepareKey(CacheKeysDict::PROFILE, ['id' => 503]), ]);

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)
5.6.10.0070.07720.32
5.6.00.0130.07020.54
5.5.160.0000.08020.06
5.5.150.0070.07320.27
5.5.140.0070.07320.06
5.5.130.0030.07720.24
5.5.120.0030.08720.25
5.5.110.0200.04320.05
5.5.100.0030.08320.23
5.5.90.0030.05020.11
5.5.80.0100.06320.17
5.5.70.0000.08320.13
5.5.60.0070.07720.00
5.5.50.0070.08020.20
5.5.40.0100.07020.23
5.5.30.0130.06320.22
5.5.20.0070.07719.97
5.5.10.0070.05020.17
5.5.00.0070.05020.22
5.4.320.0070.07719.33
5.4.310.0170.06319.01
5.4.300.0070.07719.18
5.4.290.0170.07319.24
5.4.280.0070.07319.02
5.4.270.0100.07018.99
5.4.260.0000.08019.14
5.4.250.0100.06719.24
5.4.240.0100.07319.15
5.4.230.0130.06719.22
5.4.220.0070.04319.33
5.4.210.0130.07019.13
5.4.200.0070.04019.16
5.4.190.0100.07319.17
5.4.180.0130.07319.22
5.4.170.0000.08318.94
5.4.160.0000.07718.99
5.4.150.0170.06318.98
5.4.140.0030.08016.55
5.4.130.0130.07016.49
5.4.120.0030.07016.43
5.4.110.0030.04716.55
5.4.100.0070.04716.60
5.4.90.0130.07016.52
5.4.80.0030.06016.51
5.4.70.0100.07316.46
5.4.60.0030.04716.50
5.4.50.0070.07316.63
5.4.40.0030.08016.58
5.4.30.0100.04716.41
5.4.20.0030.07316.43
5.4.10.0000.07716.54
5.4.00.0070.08015.89
5.3.290.0070.07314.67
5.3.280.0070.07314.60
5.3.270.0070.07714.75
5.3.260.0100.06714.59
5.3.250.0130.06314.56
5.3.240.0100.07314.69
5.3.230.0100.07314.56
5.3.220.0000.07714.64
5.3.210.0030.08014.65
5.3.200.0100.06014.42
5.3.190.0130.07014.69
5.3.180.0170.05014.59
5.3.170.0100.06014.57
5.3.160.0070.06014.68
5.3.150.0070.03314.55
5.3.140.0100.06714.59
5.3.130.0030.06714.55
5.3.120.0100.07314.57
5.3.110.0070.07014.40
5.3.100.0070.07014.04
5.3.90.0100.07314.16
5.3.80.0030.07314.16
5.3.70.0070.07714.02
5.3.60.0070.05713.86
5.3.50.0030.07014.02
5.3.40.0070.07713.95
5.3.30.0130.06313.93
5.3.20.0100.07013.64
5.3.10.0030.04713.78
5.3.00.0100.07013.67
5.2.170.0030.05012.60
5.2.160.0000.06312.60
5.2.150.0000.04312.60
5.2.140.0070.05312.60
5.2.130.0070.06312.60
5.2.120.0070.06012.60
5.2.110.0030.06312.60
5.2.100.0100.03012.60
5.2.90.0070.05712.60
5.2.80.0030.05012.60
5.2.70.0070.06312.60
5.2.60.0070.06312.60
5.2.50.0000.06312.60
5.2.40.0100.04712.60
5.2.30.0030.06012.60
5.2.20.0000.06312.60
5.2.10.0070.05012.60
5.2.00.0000.06012.60
5.1.60.0070.04712.60
5.1.50.0070.04712.60
5.1.40.0000.06012.60
5.1.30.0000.04312.60
5.1.20.0070.04312.60
5.1.10.0000.05712.60
5.1.00.0000.05712.60
5.0.50.0030.04712.60
5.0.40.0000.04012.60
5.0.30.0000.05012.60
5.0.20.0030.02012.60
5.0.10.0000.04712.60
5.0.00.0000.06712.60
4.4.90.0030.03712.60
4.4.80.0030.03712.60
4.4.70.0000.04012.60
4.4.60.0030.03312.60
4.4.50.0030.03312.60
4.4.40.0030.05012.60
4.4.30.0030.03312.60
4.4.20.0070.02312.60
4.4.10.0070.03312.60
4.4.00.0070.05012.60
4.3.110.0130.01712.60
4.3.100.0070.03012.60
4.3.90.0000.03012.60
4.3.80.0070.04712.60
4.3.70.0030.02312.60
4.3.60.0000.03712.60
4.3.50.0000.03312.60
4.3.40.0030.05012.60
4.3.30.0000.02712.60
4.3.20.0000.04012.60
4.3.10.0000.03712.60
4.3.00.0000.03012.60

preferences:
144.52 ms | 1394 KiB | 7 Q