How to Convert Camel Case to Snake Case in PHP?
This tutorial shows you how to convert camel case to snake case in php. We will use php convert camelcase to snake case. you will learn laravel convert camelcase to snake case. I explained simply step by step php convert camelcase to snake case. So, let's follow a few steps to create an example of convert camel case to snake case php.
I will give you a very short example of how to convert a camel case to a snake case in php. you can see the below camel case string into the snake_case example with output:
"camelCaseToSnakeCase" into "camel_case_to_snake_case"
"getPosts" into "get_posts"
"getUsers" into "get_users"
So, let's see below example code and let's check it.
* Write code on Method
* @return response()
return strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $string));
I hope it can help you...
We are Recommending you
- How to Replace \n with br in PHP?
- PHP Google Recaptcha V2 Example Tutorial
- How to Add Text Watermark to Image in PHP?
- How to Add Watermark in Image using PHP?
- PHP implode() Function Example Tutorial
- How to Convert Array to String in PHP?
- PHP explode() Function Example Tutorial
- How to remove white space from string in PHP?
- How to add jquery modal popup in PHP?
- How to check file is exists or not in PHP?
- How to Send Mail in PHP Laravel?
- How can i print php variable in jquery?
- How to remove null values from array in PHP?