3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Setup $count = 1000; function camelcaseCurrent($file) { $r1 = ucwords(str_replace(array('_', '-', '/'), ' ', $file)); $r2 = str_replace(' ', '', $r1); return $r2; } function camelcaseNew($file) { $file = str_replace('_', ' ', $file); $file = str_replace('-', ' ', $file); $file = str_replace('/', ' ', $file); $r1 = ucwords($file); $r2 = str_replace(' ', '', $r1); return $r2; } // Warm up for($i = 0; $i < $count; $i++) { camelcaseCurrent('asset_library'); camelcaseNew('asset_library'); } // Test - current $t0 = microtime(true); for($i = 0; $i < $count; $i++) { camelcaseCurrent('asset_library'); } $deltaCurrent = microtime(true) - $t0; // Test - new $t0 = microtime(true); for($i = 0; $i < $count; $i++) { camelcaseNew('asset_library'); } $deltaNew = microtime(true) - $t0; echo "case current: ", round($deltaCurrent * 1000, 2), " ms\n"; echo "case new: ", round($deltaNew * 1000, 2), " ms\n"; echo "new gain: ", round($deltaNew * 100 / $deltaCurrent - 100, 2), " %\n";
Output for 7.3.1
case current: 0.72 ms case new: 0.81 ms new gain: 13.48 %
Output for 7.3.0
case current: 0.72 ms case new: 0.75 ms new gain: 4.47 %
Output for 7.2.13
case current: 0.76 ms case new: 0.87 ms new gain: 14.51 %
Output for 7.2.12
case current: 0.5 ms case new: 0.56 ms new gain: 13.46 %
Output for 7.2.11
case current: 0.51 ms case new: 0.71 ms new gain: 37.87 %
Output for 7.2.10
case current: 0.5 ms case new: 0.59 ms new gain: 16.05 %
Output for 7.2.9
case current: 0.57 ms case new: 0.58 ms new gain: 1.08 %
Output for 7.2.8
case current: 1.33 ms case new: 1.53 ms new gain: 14.49 %
Output for 7.2.7
case current: 0.56 ms case new: 0.82 ms new gain: 46.88 %
Output for 7.2.6
case current: 0.52 ms case new: 0.55 ms new gain: 7.34 %
Output for 7.2.5
case current: 0.51 ms case new: 0.57 ms new gain: 12.06 %
Output for 7.2.4
case current: 0.55 ms case new: 0.62 ms new gain: 12.79 %
Output for 7.2.3
case current: 0.71 ms case new: 0.8 ms new gain: 13.42 %
Output for 7.2.2
case current: 0.63 ms case new: 0.68 ms new gain: 6.93 %
Output for 7.2.1
case current: 0.6 ms case new: 0.73 ms new gain: 22.44 %
Output for 7.2.0
case current: 0.55 ms case new: 0.57 ms new gain: 4.14 %
Output for 7.1.25
case current: 0.69 ms case new: 0.88 ms new gain: 27.32 %
Output for 7.1.7
case current: 0.3 ms case new: 0.3 ms new gain: -2.27 %
Output for 7.1.6
case current: 0.58 ms case new: 0.75 ms new gain: 28.41 %
Output for 7.1.5
case current: 0.34 ms case new: 0.38 ms new gain: 11.5 %
Output for 7.1.0
case current: 0.53 ms case new: 0.59 ms new gain: 11.5 %
Output for 7.0.20
case current: 0.28 ms case new: 0.33 ms new gain: 16.26 %
Output for 7.0.14
case current: 0.53 ms case new: 0.58 ms new gain: 9.23 %
Output for 7.0.6
case current: 0.38 ms case new: 0.4 ms new gain: 5.49 %
Output for 7.0.5
case current: 0.4 ms case new: 0.45 ms new gain: 10.47 %
Output for 7.0.4
case current: 0.36 ms case new: 0.38 ms new gain: 4.65 %
Output for 7.0.3
case current: 0.29 ms case new: 0.33 ms new gain: 12.21 %
Output for 7.0.2
case current: 0.31 ms case new: 0.33 ms new gain: 7.17 %
Output for 7.0.1
case current: 0.38 ms case new: 0.41 ms new gain: 7.12 %
Output for 7.0.0
case current: 0.41 ms case new: 0.45 ms new gain: 8.97 %
Output for 5.6.28
case current: 1.81 ms case new: 2.09 ms new gain: 15.59 %
Output for 5.6.21
case current: 1.45 ms case new: 1.67 ms new gain: 15.54 %
Output for 5.6.20
case current: 1.51 ms case new: 1.74 ms new gain: 15.34 %
Output for 5.6.19
case current: 1.79 ms case new: 2.09 ms new gain: 16.85 %
Output for 5.6.18
case current: 0.85 ms case new: 0.99 ms new gain: 15.86 %
Output for 5.6.17
case current: 1.39 ms case new: 1.5 ms new gain: 7.78 %
Output for 5.6.16
case current: 1.17 ms case new: 1.19 ms new gain: 1.88 %
Output for 5.6.15
case current: 0.88 ms case new: 1.02 ms new gain: 16.73 %
Output for 5.6.14
case current: 0.9 ms case new: 1.06 ms new gain: 17.95 %
Output for 5.6.13
case current: 0.97 ms case new: 1.23 ms new gain: 26.51 %
Output for 5.6.12
case current: 1.46 ms case new: 1.7 ms new gain: 16.89 %
Output for 5.6.11
case current: 1.25 ms case new: 1.42 ms new gain: 14.01 %
Output for 5.6.10
case current: 1.41 ms case new: 1.25 ms new gain: -11.66 %
Output for 5.6.9
case current: 1.44 ms case new: 1.59 ms new gain: 10.85 %
Output for 5.6.8
case current: 1.3 ms case new: 1.48 ms new gain: 13.25 %
Output for 5.6.7
case current: 0.92 ms case new: 1.06 ms new gain: 15.36 %
Output for 5.5.35
case current: 1.08 ms case new: 1.16 ms new gain: 7.79 %
Output for 5.5.34
case current: 1.25 ms case new: 1.67 ms new gain: 33.72 %
Output for 5.5.33
case current: 1.34 ms case new: 1.56 ms new gain: 16.98 %
Output for 5.5.32
case current: 1.4 ms case new: 1.66 ms new gain: 18.89 %
Output for 5.5.31
case current: 1.28 ms case new: 1.25 ms new gain: -2.56 %
Output for 5.5.30
case current: 1.51 ms case new: 1.74 ms new gain: 15.24 %
Output for 5.5.29
case current: 1.49 ms case new: 1.78 ms new gain: 19.29 %
Output for 5.5.28
case current: 1.5 ms case new: 1.73 ms new gain: 15.7 %
Output for 5.5.27
case current: 1.51 ms case new: 1.72 ms new gain: 14.19 %
Output for 5.5.26
case current: 1.44 ms case new: 1.57 ms new gain: 8.74 %
Output for 5.5.25
case current: 1.49 ms case new: 1.75 ms new gain: 17.36 %
Output for 5.5.24
case current: 1.35 ms case new: 1.63 ms new gain: 20.35 %
Output for 5.4.45
case current: 1.75 ms case new: 2.52 ms new gain: 43.47 %
Output for 5.4.44
case current: 1.42 ms case new: 1.7 ms new gain: 19.38 %
Output for 5.4.43
case current: 1.39 ms case new: 1.7 ms new gain: 22.34 %
Output for 5.4.42
case current: 1.49 ms case new: 1.75 ms new gain: 17.35 %
Output for 5.4.41
case current: 1.66 ms case new: 1.78 ms new gain: 7.35 %
Output for 5.4.40
case current: 1.94 ms case new: 1.91 ms new gain: -1.33 %
Output for 5.4.39
case current: 1.63 ms case new: 1.77 ms new gain: 8.85 %
Output for 5.4.38
case current: 1.49 ms case new: 1.79 ms new gain: 20.23 %
Output for 5.4.37
case current: 2.08 ms case new: 2.54 ms new gain: 21.93 %
Output for 5.4.36
case current: 1.72 ms case new: 1.96 ms new gain: 13.72 %
Output for 5.4.35
case current: 1.07 ms case new: 1.26 ms new gain: 17.62 %
Output for 5.4.34
case current: 1.2 ms case new: 1.37 ms new gain: 14.45 %
Output for 5.4.32
case current: 1.17 ms case new: 1.24 ms new gain: 6.06 %
Output for 5.4.31
case current: 1.04 ms case new: 1.25 ms new gain: 20.06 %
Output for 5.4.30
case current: 1.03 ms case new: 1.26 ms new gain: 22.89 %
Output for 5.4.29
case current: 1.08 ms case new: 1.26 ms new gain: 16.31 %
Output for 5.4.28
case current: 2.59 ms case new: 3.04 ms new gain: 17.3 %
Output for 5.4.27
case current: 1.11 ms case new: 1.28 ms new gain: 14.75 %
Output for 5.4.26
case current: 2.26 ms case new: 2.6 ms new gain: 14.98 %
Output for 5.4.25
case current: 2.73 ms case new: 2.85 ms new gain: 4.4 %
Output for 5.4.24
case current: 2.58 ms case new: 2.88 ms new gain: 11.62 %
Output for 5.4.23
case current: 1.94 ms case new: 3.47 ms new gain: 78.72 %
Output for 5.4.22
case current: 1.46 ms case new: 1.66 ms new gain: 13.79 %
Output for 5.4.21
case current: 2.43 ms case new: 2.91 ms new gain: 20.04 %
Output for 5.4.20
case current: 1.64 ms case new: 1.84 ms new gain: 12.03 %
Output for 5.4.19
case current: 1.33 ms case new: 1.7 ms new gain: 27.74 %
Output for 5.4.18
case current: 2.37 ms case new: 2.96 ms new gain: 24.7 %
Output for 5.4.17
case current: 2.37 ms case new: 2.73 ms new gain: 14.88 %
Output for 5.4.16
case current: 1.48 ms case new: 2.14 ms new gain: 44.96 %
Output for 5.4.15
case current: 1.7 ms case new: 1.79 ms new gain: 4.93 %
Output for 5.4.14
case current: 3.32 ms case new: 4.23 ms new gain: 27.49 %
Output for 5.4.13
case current: 2.19 ms case new: 1.75 ms new gain: -19.96 %
Output for 5.4.12
case current: 1.46 ms case new: 1.61 ms new gain: 10.16 %
Output for 5.4.11
case current: 1.37 ms case new: 1.63 ms new gain: 19.14 %
Output for 5.4.10
case current: 1.45 ms case new: 1.68 ms new gain: 16.16 %
Output for 5.4.9
case current: 1.43 ms case new: 1.88 ms new gain: 31.74 %
Output for 5.4.8
case current: 1.46 ms case new: 1.71 ms new gain: 17.33 %
Output for 5.4.7
case current: 1.4 ms case new: 1.63 ms new gain: 16.81 %
Output for 5.4.6
case current: 1.35 ms case new: 1.88 ms new gain: 39.51 %
Output for 5.4.5
case current: 1.41 ms case new: 1.89 ms new gain: 34.29 %
Output for 5.4.4
case current: 1.7 ms case new: 1.64 ms new gain: -3.35 %
Output for 5.4.3
case current: 1.49 ms case new: 1.89 ms new gain: 27.43 %
Output for 5.4.2
case current: 1.39 ms case new: 1.75 ms new gain: 26.25 %
Output for 5.4.1
case current: 1.39 ms case new: 1.72 ms new gain: 23.45 %
Output for 5.4.0
case current: 2.9 ms case new: 3.32 ms new gain: 14.41 %
Output for 5.3.29
case current: 1.25 ms case new: 1.52 ms new gain: 21.55 %
Output for 5.3.28
case current: 1.95 ms case new: 2.6 ms new gain: 33.5 %
Output for 5.3.27
case current: 3.1 ms case new: 3.48 ms new gain: 12.47 %
Output for 5.3.26
case current: 1.69 ms case new: 1.98 ms new gain: 16.98 %
Output for 5.3.25
case current: 2.27 ms case new: 2.7 ms new gain: 19.02 %
Output for 5.3.24
case current: 2.84 ms case new: 2.28 ms new gain: -19.6 %
Output for 5.3.23
case current: 1.8 ms case new: 1.96 ms new gain: 8.95 %
Output for 5.3.22
case current: 1.74 ms case new: 2.09 ms new gain: 20.23 %
Output for 5.3.21
case current: 1.89 ms case new: 2.27 ms new gain: 20.27 %
Output for 5.3.20
case current: 1.83 ms case new: 2.14 ms new gain: 16.52 %
Output for 5.3.19
case current: 3.11 ms case new: 3.45 ms new gain: 11.2 %
Output for 5.3.18
case current: 1.79 ms case new: 2.09 ms new gain: 16.9 %
Output for 5.3.17
case current: 1.84 ms case new: 2.34 ms new gain: 26.98 %
Output for 5.3.16
case current: 1.95 ms case new: 2.31 ms new gain: 18.36 %
Output for 5.3.15
case current: 1.73 ms case new: 2.18 ms new gain: 25.95 %
Output for 5.3.14
case current: 1.9 ms case new: 2.16 ms new gain: 14.08 %
Output for 5.3.13
case current: 2.05 ms case new: 2.16 ms new gain: 4.97 %
Output for 5.3.12
case current: 1.79 ms case new: 2.2 ms new gain: 23.29 %
Output for 5.3.11
case current: 1.81 ms case new: 2.93 ms new gain: 61.69 %
Output for 5.3.10
case current: 1.87 ms case new: 2.14 ms new gain: 14.73 %
Output for 5.3.9
case current: 1.87 ms case new: 3.27 ms new gain: 74.58 %
Output for 5.3.8
case current: 1.95 ms case new: 2.21 ms new gain: 13.27 %
Output for 5.3.7
case current: 2.31 ms case new: 2.32 ms new gain: 0.18 %
Output for 5.3.6
case current: 2.73 ms case new: 2.86 ms new gain: 4.84 %
Output for 5.3.5
case current: 2 ms case new: 2.29 ms new gain: 14.47 %
Output for 5.3.4
case current: 2.12 ms case new: 2.65 ms new gain: 24.85 %
Output for 5.3.3
case current: 1.94 ms case new: 2.3 ms new gain: 18.59 %
Output for 5.3.2
case current: 1.96 ms case new: 2.2 ms new gain: 11.94 %
Output for 5.3.1
case current: 1.9 ms case new: 2.27 ms new gain: 19.37 %
Output for 5.3.0
case current: 3.59 ms case new: 4.24 ms new gain: 18.23 %
Output for 5.2.17
case current: 2.46 ms case new: 2.45 ms new gain: -0.2 %
Output for 5.2.16
case current: 3.28 ms case new: 3.65 ms new gain: 11.47 %
Output for 5.2.15
case current: 1.85 ms case new: 2.27 ms new gain: 22.56 %
Output for 5.2.14
case current: 1.92 ms case new: 2.18 ms new gain: 13.39 %
Output for 5.2.13
case current: 3.02 ms case new: 3.48 ms new gain: 15.26 %
Output for 5.2.12
case current: 1.85 ms case new: 2.1 ms new gain: 13.57 %
Output for 5.2.11
case current: 2.18 ms case new: 5.15 ms new gain: 136.49 %
Output for 5.2.10
case current: 1.85 ms case new: 2.12 ms new gain: 14.63 %
Output for 5.2.9
case current: 2.04 ms case new: 2.28 ms new gain: 11.97 %
Output for 5.2.8
case current: 1.8 ms case new: 2.16 ms new gain: 20.29 %
Output for 5.2.7
case current: 1.8 ms case new: 2.1 ms new gain: 16.88 %
Output for 5.2.6
case current: 3.3 ms case new: 3.64 ms new gain: 10.28 %
Output for 5.2.5
case current: 1.92 ms case new: 2.16 ms new gain: 12.48 %
Output for 5.2.4
case current: 1.8 ms case new: 2.71 ms new gain: 50.32 %
Output for 5.2.3
case current: 1.83 ms case new: 2.31 ms new gain: 25.92 %
Output for 5.2.2
case current: 1.93 ms case new: 2.2 ms new gain: 14.05 %
Output for 5.2.1
case current: 2.08 ms case new: 2.12 ms new gain: 1.58 %
Output for 5.2.0
case current: 3.18 ms case new: 3.53 ms new gain: 10.93 %
Output for 5.1.6
case current: 1.73 ms case new: 2.12 ms new gain: 22.55 %
Output for 5.1.5
case current: 1.84 ms case new: 2.18 ms new gain: 18.5 %
Output for 5.1.4
case current: 1.76 ms case new: 2.04 ms new gain: 15.51 %
Output for 5.1.3
case current: 2.27 ms case new: 2.42 ms new gain: 6.64 %
Output for 5.1.2
case current: 3.11 ms case new: 3.27 ms new gain: 5.31 %
Output for 5.1.1
case current: 1.85 ms case new: 2.31 ms new gain: 24.8 %
Output for 5.1.0
case current: 1.99 ms case new: 2.29 ms new gain: 15.47 %
Output for 5.0.5
case current: 2.43 ms case new: 3.91 ms new gain: 61.11 %
Output for 5.0.4
case current: 2.55 ms case new: 3.26 ms new gain: 27.86 %
Output for 5.0.3
case current: 2.51 ms case new: 2.83 ms new gain: 12.59 %
Output for 5.0.2
case current: 2.54 ms case new: 2.97 ms new gain: 16.97 %
Output for 5.0.1
case current: 2.35 ms case new: 2.9 ms new gain: 23.34 %
Output for 5.0.0
case current: 2.68 ms case new: 3.41 ms new gain: 27.22 %
Output for 4.4.9
case current: 3.61 ms case new: 3.29 ms new gain: -9.05 %
Output for 4.4.8
case current: 2.27 ms case new: 2.76 ms new gain: 21.75 %
Output for 4.4.7
case current: 2.61 ms case new: 3.05 ms new gain: 16.78 %
Output for 4.4.6
case current: 2.78 ms case new: 3.18 ms new gain: 14.33 %
Output for 4.4.5
case current: 3.89 ms case new: 4.87 ms new gain: 25.2 %
Output for 4.4.4
case current: 4.28 ms case new: 4.89 ms new gain: 14.35 %
Output for 4.4.3
case current: 2.8 ms case new: 3.57 ms new gain: 27.52 %
Output for 4.4.2
case current: 2.44 ms case new: 3.03 ms new gain: 23.98 %
Output for 4.4.1
case current: 3.93 ms case new: 4.59 ms new gain: 16.94 %
Output for 4.4.0
case current: 2.39 ms case new: 2.94 ms new gain: 23 %
Output for 4.3.11
case current: 2.46 ms case new: 2.88 ms new gain: 17 %
Output for 4.3.10
case current: 2.65 ms case new: 3.46 ms new gain: 30.9 %
Output for 4.3.9
case current: 3.73 ms case new: 4.72 ms new gain: 26.54 %
Output for 4.3.8
case current: 2.53 ms case new: 3.13 ms new gain: 23.78 %
Output for 4.3.7
case current: 2.35 ms case new: 2.78 ms new gain: 18.45 %
Output for 4.3.6
case current: 2.47 ms case new: 2.91 ms new gain: 17.6 %
Output for 4.3.5
case current: 2.35 ms case new: 2.78 ms new gain: 18.09 %
Output for 4.3.4
case current: 2.31 ms case new: 2.86 ms new gain: 23.79 %
Output for 4.3.3
case current: 2.32 ms case new: 3.01 ms new gain: 29.39 %
Output for 4.3.2
case current: 2.3 ms case new: 2.91 ms new gain: 26.49 %
Output for 4.3.1
case current: 2.24 ms case new: 2.74 ms new gain: 22.06 %
Output for 4.3.0
case current: 2.53 ms case new: 2.7 ms new gain: 6.77 %

preferences:
165.64 ms | 401 KiB | 191 Q