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) { $r1 = ucwords(str_replace(array('_', '-', '/'), '', $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.5 ms case new: 0.39 ms new gain: -22.12 %
Output for 7.0.14
case current: 0.58 ms case new: 0.54 ms new gain: -6.9 %
Output for 7.0.11
case current: 0.37 ms case new: 0.34 ms new gain: -7.3 %
Output for 7.0.10
case current: 0.34 ms case new: 0.32 ms new gain: -5.37 %
Output for 7.0.9
case current: 0.45 ms case new: 0.42 ms new gain: -5.61 %
Output for 7.0.8
case current: 0.4 ms case new: 0.36 ms new gain: -9.33 %
Output for 7.0.7
case current: 0.38 ms case new: 0.34 ms new gain: -11.26 %
Output for 7.0.6
case current: 0.36 ms case new: 0.32 ms new gain: -12.15 %
Output for 7.0.5
case current: 0.41 ms case new: 0.37 ms new gain: -9.8 %
Output for 7.0.4
case current: 0.3 ms case new: 0.28 ms new gain: -7.01 %
Output for 7.0.3
case current: 0.32 ms case new: 0.29 ms new gain: -10.91 %
Output for 7.0.2
case current: 0.3 ms case new: 0.27 ms new gain: -10.22 %
Output for 7.0.1
case current: 0.29 ms case new: 0.26 ms new gain: -10.07 %
Output for 7.0.0
case current: 0.31 ms case new: 0.29 ms new gain: -9.46 %
Output for 5.6.28
case current: 1.87 ms case new: 1.82 ms new gain: -2.83 %
Output for 5.6.26
case current: 0.89 ms case new: 0.85 ms new gain: -4.16 %
Output for 5.6.25
case current: 1.21 ms case new: 1.11 ms new gain: -7.97 %
Output for 5.6.24
case current: 1.13 ms case new: 1.09 ms new gain: -3.18 %
Output for 5.6.23
case current: 1.15 ms case new: 1.12 ms new gain: -3.13 %
Output for 5.6.22
case current: 1.26 ms case new: 1.22 ms new gain: -2.71 %
Output for 5.6.21
case current: 1.18 ms case new: 1.23 ms new gain: 4.25 %
Output for 5.6.20
case current: 1.41 ms case new: 1.33 ms new gain: -5.96 %
Output for 5.6.19
case current: 1.2 ms case new: 1.15 ms new gain: -4.08 %
Output for 5.6.18
case current: 1.18 ms case new: 1.19 ms new gain: 1.54 %
Output for 5.6.17
case current: 1.18 ms case new: 1.07 ms new gain: -9.16 %
Output for 5.6.16
case current: 0.87 ms case new: 0.85 ms new gain: -2.19 %
Output for 5.6.15
case current: 0.87 ms case new: 0.83 ms new gain: -4.26 %
Output for 5.6.14
case current: 0.93 ms case new: 0.89 ms new gain: -4.31 %
Output for 5.6.13
case current: 0.92 ms case new: 0.9 ms new gain: -2.61 %
Output for 5.6.12
case current: 0.88 ms case new: 0.87 ms new gain: -1.49 %
Output for 5.6.11
case current: 1.03 ms case new: 1 ms new gain: -2.72 %
Output for 5.6.10
case current: 0.87 ms case new: 0.84 ms new gain: -2.97 %
Output for 5.6.9
case current: 0.99 ms case new: 0.99 ms new gain: 0.19 %
Output for 5.6.8
case current: 0.87 ms case new: 0.84 ms new gain: -3.79 %
Output for 5.6.7
case current: 0.86 ms case new: 0.84 ms new gain: -2.44 %
Output for 5.6.6
case current: 0.86 ms case new: 0.83 ms new gain: -3.69 %
Output for 5.6.5
case current: 0.95 ms case new: 1.02 ms new gain: 7.5 %
Output for 5.6.4
case current: 0.99 ms case new: 0.96 ms new gain: -2.63 %
Output for 5.6.3
case current: 0.93 ms case new: 0.91 ms new gain: -2.07 %
Output for 5.6.2
case current: 0.86 ms case new: 0.83 ms new gain: -4.07 %
Output for 5.6.1
case current: 0.86 ms case new: 0.83 ms new gain: -3.25 %
Output for 5.6.0
case current: 1.52 ms case new: 1.44 ms new gain: -5.77 %
Output for 5.5.38
case current: 0.95 ms case new: 0.87 ms new gain: -7.81 %
Output for 5.5.37
case current: 1.19 ms case new: 1.17 ms new gain: -1.5 %
Output for 5.5.36
case current: 1.37 ms case new: 1.33 ms new gain: -2.56 %
Output for 5.5.35
case current: 1.45 ms case new: 1.16 ms new gain: -19.97 %
Output for 5.5.34
case current: 1.24 ms case new: 1.06 ms new gain: -14.64 %
Output for 5.5.33
case current: 0.94 ms case new: 0.9 ms new gain: -4.24 %
Output for 5.5.32
case current: 1.98 ms case new: 1.91 ms new gain: -3.54 %
Output for 5.5.31
case current: 1.3 ms case new: 1.25 ms new gain: -4.3 %
Output for 5.5.30
case current: 1.06 ms case new: 1.03 ms new gain: -2.27 %
Output for 5.5.29
case current: 0.91 ms case new: 0.89 ms new gain: -1.86 %
Output for 5.5.28
case current: 0.89 ms case new: 0.88 ms new gain: -1.34 %
Output for 5.5.27
case current: 1.09 ms case new: 1.03 ms new gain: -5.69 %
Output for 5.5.26
case current: 1.48 ms case new: 1.43 ms new gain: -3.39 %
Output for 5.5.25
case current: 1.05 ms case new: 1.06 ms new gain: 1.52 %
Output for 5.5.24
case current: 1.07 ms case new: 1.05 ms new gain: -2.75 %
Output for 5.5.23
case current: 0.96 ms case new: 0.91 ms new gain: -5.29 %
Output for 5.5.22
case current: 0.97 ms case new: 0.87 ms new gain: -10.31 %
Output for 5.5.21
case current: 1.22 ms case new: 1.24 ms new gain: 1.65 %
Output for 5.5.20
case current: 0.89 ms case new: 0.86 ms new gain: -3.61 %
Output for 5.5.19
case current: 0.89 ms case new: 0.88 ms new gain: -2.08 %
Output for 5.5.18
case current: 0.92 ms case new: 0.9 ms new gain: -2.46 %
Output for 5.5.16
case current: 1.75 ms case new: 1.68 ms new gain: -4.34 %
Output for 5.5.15
case current: 1.36 ms case new: 1.33 ms new gain: -2.71 %
Output for 5.5.14
case current: 1.47 ms case new: 1.43 ms new gain: -2.37 %
Output for 5.5.13
case current: 1.41 ms case new: 1.32 ms new gain: -5.91 %
Output for 5.5.12
case current: 1.34 ms case new: 1.32 ms new gain: -2.08 %
Output for 5.5.11
case current: 1.33 ms case new: 1.26 ms new gain: -4.83 %
Output for 5.5.10
case current: 1.44 ms case new: 1.41 ms new gain: -1.68 %
Output for 5.5.9
case current: 1.42 ms case new: 1.45 ms new gain: 2.12 %
Output for 5.5.8
case current: 1.44 ms case new: 1.44 ms new gain: -0.07 %
Output for 5.5.7
case current: 1.45 ms case new: 1.41 ms new gain: -3.23 %
Output for 5.5.6
case current: 1.54 ms case new: 1.46 ms new gain: -4.89 %
Output for 5.5.5
case current: 1.25 ms case new: 1.18 ms new gain: -5.52 %
Output for 5.5.4
case current: 1.45 ms case new: 1.41 ms new gain: -2.36 %
Output for 5.5.3
case current: 1.39 ms case new: 1.37 ms new gain: -1.38 %
Output for 5.5.2
case current: 1.14 ms case new: 1.4 ms new gain: 22.36 %
Output for 5.5.1
case current: 1.47 ms case new: 1.41 ms new gain: -4.35 %
Output for 5.5.0
case current: 1.2 ms case new: 1.16 ms new gain: -3.25 %
Output for 5.4.45
case current: 0.87 ms case new: 0.84 ms new gain: -3.22 %
Output for 5.4.44
case current: 0.92 ms case new: 0.89 ms new gain: -2.96 %
Output for 5.4.43
case current: 1.05 ms case new: 0.99 ms new gain: -5.2 %
Output for 5.4.42
case current: 1.22 ms case new: 1.19 ms new gain: -2.62 %
Output for 5.4.41
case current: 0.86 ms case new: 0.83 ms new gain: -3.48 %
Output for 5.4.40
case current: 0.85 ms case new: 0.82 ms new gain: -3.61 %
Output for 5.4.39
case current: 1.08 ms case new: 0.78 ms new gain: -27.66 %
Output for 5.4.38
case current: 1.03 ms case new: 0.86 ms new gain: -16.7 %
Output for 5.4.37
case current: 0.85 ms case new: 0.83 ms new gain: -2.01 %
Output for 5.4.36
case current: 0.85 ms case new: 0.82 ms new gain: -2.59 %
Output for 5.4.35
case current: 0.85 ms case new: 0.83 ms new gain: -2.33 %
Output for 5.4.34
case current: 1.5 ms case new: 1.45 ms new gain: -3.53 %
Output for 5.4.32
case current: 1.02 ms case new: 0.99 ms new gain: -2.93 %
Output for 5.4.31
case current: 1.38 ms case new: 1.34 ms new gain: -2.88 %
Output for 5.4.30
case current: 0.84 ms case new: 0.83 ms new gain: -1.81 %
Output for 5.4.29
case current: 1.38 ms case new: 1.35 ms new gain: -1.96 %
Output for 5.4.28
case current: 1.16 ms case new: 0.98 ms new gain: -15.41 %
Output for 5.4.27
case current: 1.45 ms case new: 1.49 ms new gain: 2.98 %
Output for 5.4.26
case current: 1.26 ms case new: 1.16 ms new gain: -7.94 %
Output for 5.4.25
case current: 1.17 ms case new: 1.14 ms new gain: -1.96 %
Output for 5.4.24
case current: 1.14 ms case new: 1.13 ms new gain: -1.29 %
Output for 5.4.23
case current: 1.05 ms case new: 1.01 ms new gain: -4.37 %
Output for 5.4.22
case current: 1.15 ms case new: 1.12 ms new gain: -2.35 %
Output for 5.4.21
case current: 1.35 ms case new: 1.33 ms new gain: -1.27 %
Output for 5.4.20
case current: 1.2 ms case new: 1.15 ms new gain: -4.47 %
Output for 5.4.19
case current: 1.24 ms case new: 1.2 ms new gain: -3.05 %
Output for 5.4.18
case current: 1.31 ms case new: 1.26 ms new gain: -4.06 %
Output for 5.4.17
case current: 1.24 ms case new: 1.24 ms new gain: 0.23 %
Output for 5.4.16
case current: 0.86 ms case new: 0.83 ms new gain: -2.92 %
Output for 5.4.15
case current: 1.02 ms case new: 1 ms new gain: -2.44 %
Output for 5.4.14
case current: 1.46 ms case new: 1.41 ms new gain: -3.14 %
Output for 5.4.13
case current: 1.05 ms case new: 1.01 ms new gain: -3.14 %
Output for 5.4.12
case current: 1.3 ms case new: 1.26 ms new gain: -3.15 %
Output for 5.4.11
case current: 1.2 ms case new: 1.16 ms new gain: -3.09 %
Output for 5.4.10
case current: 1.44 ms case new: 1.41 ms new gain: -1.95 %
Output for 5.4.9
case current: 1.09 ms case new: 1.11 ms new gain: 1.29 %
Output for 5.4.8
case current: 1.33 ms case new: 1.28 ms new gain: -3.7 %
Output for 5.4.7
case current: 1.19 ms case new: 1.17 ms new gain: -1.68 %
Output for 5.4.6
case current: 1.03 ms case new: 1.02 ms new gain: -0.7 %
Output for 5.4.5
case current: 1.23 ms case new: 1.21 ms new gain: -1.22 %
Output for 5.4.4
case current: 1.24 ms case new: 1.21 ms new gain: -2.57 %
Output for 5.4.3
case current: 1.14 ms case new: 1.1 ms new gain: -2.89 %
Output for 5.4.2
case current: 1.19 ms case new: 1.19 ms new gain: 0.26 %
Output for 5.4.1
case current: 1.18 ms case new: 1.16 ms new gain: -2.12 %
Output for 5.4.0
case current: 1.48 ms case new: 1.43 ms new gain: -3.84 %
Output for 5.3.29
case current: 1.1 ms case new: 1.21 ms new gain: 9.91 %
Output for 5.3.28
case current: 1.81 ms case new: 1.62 ms new gain: -10.55 %
Output for 5.3.27
case current: 1.42 ms case new: 1.38 ms new gain: -2.54 %
Output for 5.3.26
case current: 2.76 ms case new: 1.36 ms new gain: -50.94 %
Output for 5.3.25
case current: 1.43 ms case new: 1.38 ms new gain: -3.42 %
Output for 5.3.24
case current: 1.12 ms case new: 1.11 ms new gain: -0.73 %
Output for 5.3.23
case current: 1.6 ms case new: 1.39 ms new gain: -12.83 %
Output for 5.3.22
case current: 1.46 ms case new: 1.41 ms new gain: -2.95 %
Output for 5.3.21
case current: 1.66 ms case new: 1.63 ms new gain: -2.04 %
Output for 5.3.20
case current: 1.7 ms case new: 1.67 ms new gain: -2.17 %
Output for 5.3.19
case current: 1.55 ms case new: 1.54 ms new gain: -1.03 %
Output for 5.3.18
case current: 1.43 ms case new: 1.48 ms new gain: 3.49 %
Output for 5.3.17
case current: 1.75 ms case new: 1.73 ms new gain: -1.54 %
Output for 5.3.16
case current: 1.79 ms case new: 1.79 ms new gain: -0.23 %
Output for 5.3.15
case current: 1.37 ms case new: 1.34 ms new gain: -2.84 %
Output for 5.3.14
case current: 1.67 ms case new: 1.6 ms new gain: -4.53 %
Output for 5.3.13
case current: 1.85 ms case new: 1.8 ms new gain: -2.82 %
Output for 5.3.12
case current: 1.52 ms case new: 1.48 ms new gain: -3.02 %
Output for 5.3.11
case current: 1.63 ms case new: 1.55 ms new gain: -5 %
Output for 5.3.10
case current: 1.73 ms case new: 1.7 ms new gain: -1.68 %
Output for 5.3.9
case current: 1.64 ms case new: 1.6 ms new gain: -2.38 %
Output for 5.3.8
case current: 1.65 ms case new: 1.6 ms new gain: -3.44 %
Output for 5.3.7
case current: 1.48 ms case new: 1.47 ms new gain: -0.61 %
Output for 5.3.6
case current: 1.83 ms case new: 1.72 ms new gain: -5.94 %
Output for 5.3.5
case current: 1.82 ms case new: 1.8 ms new gain: -1.32 %
Output for 5.3.4
case current: 1.57 ms case new: 1.53 ms new gain: -2.92 %
Output for 5.3.3
case current: 1.72 ms case new: 1.68 ms new gain: -1.85 %
Output for 5.3.2
case current: 1.9 ms case new: 1.79 ms new gain: -5.79 %
Output for 5.3.1
case current: 1.41 ms case new: 1.41 ms new gain: 0.05 %
Output for 5.3.0
case current: 1.47 ms case new: 1.44 ms new gain: -1.96 %
Output for 5.2.17
case current: 1.69 ms case new: 1.65 ms new gain: -1.97 %
Output for 5.2.16
case current: 1.69 ms case new: 1.67 ms new gain: -1.02 %
Output for 5.2.15
case current: 1.87 ms case new: 1.82 ms new gain: -2.71 %
Output for 5.2.14
case current: 1.83 ms case new: 1.8 ms new gain: -1.68 %
Output for 5.2.13
case current: 1.55 ms case new: 1.5 ms new gain: -2.78 %
Output for 5.2.12
case current: 1.66 ms case new: 1.6 ms new gain: -3.39 %
Output for 5.2.11
case current: 1.95 ms case new: 1.9 ms new gain: -2.61 %
Output for 5.2.10
case current: 2.77 ms case new: 1.93 ms new gain: -30.4 %
Output for 5.2.9
case current: 1.73 ms case new: 1.64 ms new gain: -5.14 %
Output for 5.2.8
case current: 2.09 ms case new: 2 ms new gain: -4.26 %
Output for 5.2.7
case current: 1.66 ms case new: 1.61 ms new gain: -2.83 %
Output for 5.2.6
case current: 1.57 ms case new: 1.53 ms new gain: -2.94 %
Output for 5.2.5
case current: 1.94 ms case new: 1.87 ms new gain: -3.35 %
Output for 5.2.4
case current: 2.07 ms case new: 2.03 ms new gain: -2.16 %
Output for 5.2.3
case current: 1.87 ms case new: 1.81 ms new gain: -3.1 %
Output for 5.2.2
case current: 1.26 ms case new: 1.69 ms new gain: 33.96 %
Output for 5.2.1
case current: 2.03 ms case new: 1.95 ms new gain: -4.33 %
Output for 5.2.0
case current: 1.95 ms case new: 1.97 ms new gain: 1.23 %
Output for 5.1.6
case current: 1.86 ms case new: 2.17 ms new gain: 17.07 %
Output for 5.1.5
case current: 1.72 ms case new: 1.69 ms new gain: -1.74 %
Output for 5.1.4
case current: 1.97 ms case new: 1.94 ms new gain: -1.73 %
Output for 5.1.3
case current: 1.98 ms case new: 1.9 ms new gain: -3.78 %
Output for 5.1.2
case current: 1.7 ms case new: 1.82 ms new gain: 7.37 %
Output for 5.1.1
case current: 1.62 ms case new: 1.62 ms new gain: 0.18 %
Output for 5.1.0
case current: 2.18 ms case new: 2.32 ms new gain: 6.57 %
Output for 5.0.5
case current: 2.65 ms case new: 2.63 ms new gain: -0.46 %
Output for 5.0.4
case current: 1.58 ms case new: 1.56 ms new gain: -1.27 %
Output for 5.0.3
case current: 2.44 ms case new: 2.4 ms new gain: -1.73 %
Output for 5.0.2
case current: 2.6 ms case new: 2.55 ms new gain: -1.73 %
Output for 5.0.1
case current: 2.52 ms case new: 2.5 ms new gain: -0.67 %
Output for 5.0.0
case current: 1.83 ms case new: 1.82 ms new gain: -0.6 %
Output for 4.4.9
case current: 2.46 ms case new: 2.42 ms new gain: -1.47 %
Output for 4.4.8
case current: 2.54 ms case new: 2.43 ms new gain: -4.33 %
Output for 4.4.7
case current: 2.92 ms case new: 2.81 ms new gain: -3.57 %
Output for 4.4.6
case current: 3.22 ms case new: 2.41 ms new gain: -25.33 %
Output for 4.4.5
case current: 2.46 ms case new: 2.41 ms new gain: -1.99 %
Output for 4.4.4
case current: 2.52 ms case new: 2.44 ms new gain: -2.98 %
Output for 4.4.3
case current: 2.62 ms case new: 2.49 ms new gain: -4.96 %
Output for 4.4.2
case current: 2.96 ms case new: 2.79 ms new gain: -5.45 %
Output for 4.4.1
case current: 2.74 ms case new: 2.69 ms new gain: -1.75 %
Output for 4.4.0
case current: 2.21 ms case new: 2.22 ms new gain: 0.23 %
Output for 4.3.11
case current: 2.38 ms case new: 2.36 ms new gain: -0.76 %
Output for 4.3.10
case current: 3.08 ms case new: 2.87 ms new gain: -6.63 %
Output for 4.3.9
case current: 2.83 ms case new: 2.81 ms new gain: -0.57 %
Output for 4.3.8
case current: 1.82 ms case new: 1.74 ms new gain: -4.39 %
Output for 4.3.7
case current: 2.19 ms case new: 2.17 ms new gain: -0.87 %
Output for 4.3.6
case current: 2.71 ms case new: 2.53 ms new gain: -6.64 %
Output for 4.3.5
case current: 2.27 ms case new: 2.27 ms new gain: -0.22 %
Output for 4.3.4
case current: 2.29 ms case new: 2.3 ms new gain: 0.7 %
Output for 4.3.3
case current: 2.55 ms case new: 2.54 ms new gain: -0.43 %
Output for 4.3.2
case current: 2.37 ms case new: 2.3 ms new gain: -2.7 %
Output for 4.3.1
case current: 2.54 ms case new: 2.41 ms new gain: -5 %
Output for 4.3.0
case current: 2.46 ms case new: 2.59 ms new gain: 5.16 %