3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $i=0; $time = microtime(true); while($i < 10) { $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 < 10) { $i++; preg_replace('/(?!^)[[:upper:]][[:lower:]]/', '$0', preg_replace('/(?!^)[[:upper:]]+/', '_'.'$0', 'VeryLongClassName')); } $time = microtime(true) - $time; echo '2: ' . number_format($time, 3) ."\n";
Output for 4.3.0 - 5.6.28, 7.0.0 - 7.1.0
1: 0.000 2: 0.000
Output for hhvm-3.12.0
1: 0.115 2: 0.000
Output for hhvm-3.10.0
1: 0.002 2: 0.000