Home  >  Article  >  php教程  >  驼峰字符串转换成下划线样式

驼峰字符串转换成下划线样式

PHP中文网
PHP中文网Original
2016-05-24 12:52:512059browse

驼峰字符串转换成下划线样式

// 驼峰字符串转换成下划线样式
$str = 'openAPI';
echo $str."<BR>";
echo strtolower(preg_replace(&#39;/((?<=[a-z])(?=[A-Z]))/&#39;, &#39;_&#39;, $str)).&#39;<br>&#39;;

 以上就是驼峰字符串转换成下划线样式的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:多个数组求笛卡尔积Next article:PHP 匹配中文字符