3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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.1.0
case current: 0.53 ms case new: 0.59 ms new gain: 11.5 %
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 hhvm-3.12.0
case current: 0.68 ms case new: 0.79 ms new gain: 16.48 %
Output for hhvm-3.10.0
case current: 0.63 ms case new: 1.15 ms new gain: 82.83 %
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: 1.11 ms case new: 1.33 ms new gain: 19.62 %
Output for 5.4.25
case current: 1.5 ms case new: 1.54 ms new gain: 2.8 %
Output for 5.4.24
case current: 1.05 ms case new: 1.25 ms new gain: 18.72 %
Output for 5.4.23
case current: 1.08 ms case new: 1.27 ms new gain: 17.87 %
Output for 5.4.22
case current: 1.1 ms case new: 1.28 ms new gain: 15.57 %
Output for 5.4.21
case current: 1.06 ms case new: 1.28 ms new gain: 20.73 %
Output for 5.4.20
case current: 1.1 ms case new: 1.37 ms new gain: 24.43 %
Output for 5.4.19
case current: 1.15 ms case new: 1.34 ms new gain: 16.48 %
Output for 5.4.18
case current: 1.2 ms case new: 1.41 ms new gain: 17.86 %
Output for 5.4.17
case current: 1.12 ms case new: 1.52 ms new gain: 35.48 %
Output for 5.4.16
case current: 1.08 ms case new: 1.27 ms new gain: 17.78 %
Output for 5.4.15
case current: 1.09 ms case new: 1.22 ms new gain: 11.77 %
Output for 5.4.14
case current: 1.06 ms case new: 1.26 ms new gain: 18.6 %
Output for 5.4.13
case current: 1.11 ms case new: 1.34 ms new gain: 20.46 %
Output for 5.4.12
case current: 1.15 ms case new: 1.39 ms new gain: 21.11 %
Output for 5.4.11
case current: 1.15 ms case new: 1.55 ms new gain: 34.63 %
Output for 5.4.10
case current: 1.21 ms case new: 1.42 ms new gain: 17.61 %
Output for 5.4.9
case current: 1.3 ms case new: 1.47 ms new gain: 12.84 %
Output for 5.4.8
case current: 1.27 ms case new: 1.39 ms new gain: 9.67 %
Output for 5.4.7
case current: 1.14 ms case new: 1.41 ms new gain: 24.16 %
Output for 5.4.6
case current: 1.24 ms case new: 1.46 ms new gain: 17.74 %
Output for 5.4.5
case current: 1.14 ms case new: 1.44 ms new gain: 26.23 %
Output for 5.4.4
case current: 1.14 ms case new: 1.54 ms new gain: 35.75 %
Output for 5.4.3
case current: 1.22 ms case new: 1.56 ms new gain: 27.75 %
Output for 5.4.2
case current: 1.27 ms case new: 1.48 ms new gain: 16.28 %
Output for 5.4.1
case current: 1.15 ms case new: 1.46 ms new gain: 27.09 %
Output for 5.4.0
case current: 1.24 ms case new: 1.53 ms new gain: 23.84 %
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.36 ms case new: 1.56 ms new gain: 14.13 %
Output for 5.3.27
case current: 1.19 ms case new: 1.47 ms new gain: 23.28 %
Output for 5.3.26
case current: 1.3 ms case new: 1.45 ms new gain: 11.11 %
Output for 5.3.25
case current: 1.23 ms case new: 1.39 ms new gain: 12.49 %
Output for 5.3.24
case current: 1.23 ms case new: 1.43 ms new gain: 16.2 %
Output for 5.3.23
case current: 1.28 ms case new: 1.51 ms new gain: 18.05 %
Output for 5.3.22
case current: 1.34 ms case new: 1.48 ms new gain: 10.53 %
Output for 5.3.21
case current: 1.31 ms case new: 1.62 ms new gain: 23.04 %
Output for 5.3.20
case current: 1.35 ms case new: 1.52 ms new gain: 12.36 %
Output for 5.3.19
case current: 1.33 ms case new: 1.57 ms new gain: 18.41 %
Output for 5.3.18
case current: 1.33 ms case new: 1.5 ms new gain: 12.86 %
Output for 5.3.17
case current: 1.35 ms case new: 1.52 ms new gain: 13.22 %
Output for 5.3.16
case current: 1.31 ms case new: 1.53 ms new gain: 16.9 %
Output for 5.3.15
case current: 1.56 ms case new: 1.5 ms new gain: -3.74 %
Output for 5.3.14
case current: 1.33 ms case new: 1.51 ms new gain: 13.12 %
Output for 5.3.13
case current: 1.36 ms case new: 1.59 ms new gain: 17.08 %
Output for 5.3.12
case current: 1.34 ms case new: 1.67 ms new gain: 24.77 %
Output for 5.3.11
case current: 1.46 ms case new: 1.62 ms new gain: 10.37 %
Output for 5.3.10
case current: 1.24 ms case new: 1.58 ms new gain: 27.4 %
Output for 5.3.9
case current: 1.39 ms case new: 1.55 ms new gain: 11.29 %
Output for 5.3.8
case current: 1.31 ms case new: 1.69 ms new gain: 29.24 %
Output for 5.3.7
case current: 1.27 ms case new: 1.6 ms new gain: 25.96 %
Output for 5.3.6
case current: 1.54 ms case new: 1.62 ms new gain: 5.17 %
Output for 5.3.5
case current: 1.48 ms case new: 1.63 ms new gain: 10.7 %
Output for 5.3.4
case current: 1.3 ms case new: 1.61 ms new gain: 23.64 %
Output for 5.3.3
case current: 1.48 ms case new: 1.74 ms new gain: 17.48 %
Output for 5.3.2
case current: 1.24 ms case new: 1.48 ms new gain: 19.85 %
Output for 5.3.1
case current: 1.32 ms case new: 1.58 ms new gain: 19.6 %
Output for 5.3.0
case current: 1.29 ms case new: 1.52 ms new gain: 17.39 %
Output for 5.2.17
case current: 1.46 ms case new: 1.53 ms new gain: 4.86 %
Output for 5.2.16
case current: 1.38 ms case new: 1.6 ms new gain: 15.64 %
Output for 5.2.15
case current: 1.35 ms case new: 1.66 ms new gain: 23.54 %
Output for 5.2.14
case current: 1.24 ms case new: 1.67 ms new gain: 35.36 %
Output for 5.2.13
case current: 1.66 ms case new: 1.59 ms new gain: -4.1 %
Output for 5.2.12
case current: 1.39 ms case new: 1.77 ms new gain: 27.24 %
Output for 5.2.11
case current: 1.48 ms case new: 1.55 ms new gain: 4.72 %
Output for 5.2.10
case current: 1.54 ms case new: 1.69 ms new gain: 9.86 %
Output for 5.2.9
case current: 1.28 ms case new: 1.53 ms new gain: 19.3 %
Output for 5.2.8
case current: 1.33 ms case new: 1.92 ms new gain: 43.86 %
Output for 5.2.7
case current: 1.38 ms case new: 1.59 ms new gain: 15.19 %
Output for 5.2.6
case current: 1.38 ms case new: 1.56 ms new gain: 12.7 %
Output for 5.2.5
case current: 1.33 ms case new: 1.54 ms new gain: 15.15 %
Output for 5.2.4
case current: 1.4 ms case new: 1.58 ms new gain: 12.86 %
Output for 5.2.3
case current: 1.39 ms case new: 1.56 ms new gain: 12.82 %
Output for 5.2.2
case current: 1.44 ms case new: 1.67 ms new gain: 16.29 %
Output for 5.2.1
case current: 1.37 ms case new: 1.56 ms new gain: 13.42 %
Output for 5.2.0
case current: 1.37 ms case new: 1.62 ms new gain: 18.8 %
Output for 5.1.6
case current: 1.66 ms case new: 1.54 ms new gain: -6.71 %
Output for 5.1.5
case current: 1.34 ms case new: 1.56 ms new gain: 16 %
Output for 5.1.4
case current: 1.43 ms case new: 1.55 ms new gain: 8.6 %
Output for 5.1.3
case current: 1.31 ms case new: 1.48 ms new gain: 12.18 %
Output for 5.1.2
case current: 1.41 ms case new: 1.57 ms new gain: 11.78 %
Output for 5.1.1
case current: 1.28 ms case new: 1.61 ms new gain: 25.53 %
Output for 5.1.0
case current: 1.45 ms case new: 1.53 ms new gain: 5.79 %
Output for 5.0.5
case current: 1.78 ms case new: 2.31 ms new gain: 29.8 %
Output for 5.0.4
case current: 1.75 ms case new: 2.19 ms new gain: 25.32 %
Output for 5.0.3
case current: 1.73 ms case new: 2.09 ms new gain: 20.99 %
Output for 5.0.2
case current: 2.94 ms case new: 3.91 ms new gain: 33.04 %
Output for 5.0.1
case current: 1.79 ms case new: 2.2 ms new gain: 23.4 %
Output for 5.0.0
case current: 1.79 ms case new: 2.33 ms new gain: 30.19 %
Output for 4.4.9
case current: 1.83 ms case new: 2.23 ms new gain: 21.96 %
Output for 4.4.8
case current: 1.83 ms case new: 2.21 ms new gain: 21.02 %
Output for 4.4.7
case current: 1.68 ms case new: 2.05 ms new gain: 21.98 %
Output for 4.4.6
case current: 2.18 ms case new: 2.2 ms new gain: 1.05 %
Output for 4.4.5
case current: 1.87 ms case new: 2.19 ms new gain: 17.08 %
Output for 4.4.4
case current: 1.81 ms case new: 2.04 ms new gain: 12.87 %
Output for 4.4.3
case current: 1.78 ms case new: 2.13 ms new gain: 19.45 %
Output for 4.4.2
case current: 1.74 ms case new: 2.13 ms new gain: 22.36 %
Output for 4.4.1
case current: 1.7 ms case new: 2.18 ms new gain: 27.77 %
Output for 4.4.0
case current: 1.69 ms case new: 2.12 ms new gain: 25.58 %
Output for 4.3.11
case current: 1.81 ms case new: 2.16 ms new gain: 18.98 %
Output for 4.3.10
case current: 1.71 ms case new: 2.15 ms new gain: 25.51 %
Output for 4.3.9
case current: 1.6 ms case new: 1.98 ms new gain: 23.57 %
Output for 4.3.8
case current: 1.77 ms case new: 2.24 ms new gain: 26.47 %
Output for 4.3.7
case current: 1.81 ms case new: 2.14 ms new gain: 18.44 %
Output for 4.3.6
case current: 1.67 ms case new: 2.06 ms new gain: 23.52 %
Output for 4.3.5
case current: 1.65 ms case new: 2.05 ms new gain: 23.84 %
Output for 4.3.4
case current: 1.61 ms case new: 2.15 ms new gain: 33.62 %
Output for 4.3.3
case current: 1.79 ms case new: 2.1 ms new gain: 17.37 %
Output for 4.3.2
case current: 1.7 ms case new: 2.04 ms new gain: 20.35 %
Output for 4.3.1
case current: 1.72 ms case new: 2.14 ms new gain: 24.52 %
Output for 4.3.0
case current: 2.53 ms case new: 2.7 ms new gain: 6.77 %