3v4l.org

run code in 300+ PHP versions simultaneously
<?php $i=0; $time = microtime(true); while($i < 50) { $i++; @preg_replace('/(^|[a-z])([A-Z])/e', 'strtolower(strlen("\\1") ? "\\1_\\2" : "\\2")', 'VeryLongClassName'); } $time = microtime(true) - $time; echo '1: ' . number_format($time, 3) ."\n"; $i=0; $time = microtime(true); while($i < 50) { $i++; @preg_replace('/(?!^)[[:upper:]][[:lower:]]/', '$0', preg_replace('/(?!^)[[:upper:]]+/', '_'.'$0', 'VeryLongClassName')); } $time = microtime(true) - $time; echo '2: ' . number_format($time, 3) ."\n";
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.0
1: 0.000 2: 0.000
Output for 5.6.28
1: 0.002 2: 0.000
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.35, 5.6.0 - 5.6.21
1: 0.001 2: 0.000

preferences:
169.44 ms | 403 KiB | 205 Q