How to convert PascalCase to pascal_case?

前端 未结 30 1597
北海茫月
北海茫月 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:06

    danielstjules/Stringy provieds a method to convert string from camelcase to snakecase.

    s('TestUCase')->underscored(); // 'test_u_case'
    

提交回复
热议问题