How to convert PascalCase to pascal_case?

前端 未结 30 1623
北海茫月
北海茫月 2020-11-29 16:36

If I had:

$string = \"PascalCase\";

I need

\"pascal_case\"

Does PHP offer a function for this purpose?

30条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 17:27

    There is a library providing this functionality:

    SnakeCaseFormatter::run('CamelCase'); // Output: "camel_case"
    

提交回复
热议问题