3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fromCamelCaseToUnderscores($str) { $str[0] = strtolower($str[0]); // Just in case first character is uppercase. $str = str_replace('ID', 'Id', $str); // Hack for the way CATS defies camelCase convention return preg_replace_callback('/([A-Z])/', function($char) { return '_' . strtolower($char[1]); }, $str); } var_dump(fromCamelCaseToUnderscores(null));
Output for git.master, git.master_jit
Warning: Trying to access array offset on value of type null in /in/o50mS on line 5 Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /in/o50mS on line 5 array(1) { [0]=> string(0) "" }
Output for rfc.property-hooks
Warning: Trying to access array offset on null in /in/o50mS on line 5 Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /in/o50mS on line 5 array(1) { [0]=> string(0) "" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
43.09 ms | 401 KiB | 8 Q