In this tutorial you will learn about the Laravel str camel() function Example and its application with practical example.
Laravel str camel() function Example
In this article, I’ll show you how to use laravel str camel() function with example. We will show example of camel function in laravel.The Str::camel method is use to convert the given string to camelCase.
Example:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Controllers\FileController; use Illuminate\Support\Str; class HomeController extends Controller { /** * Show the application dashboard. * * @return \Illuminate\Contracts\Support\Renderable */ public function index() { $camel1 = Str::camel('foo_bar'); print_r($camel1); // output - fooBar $camel2 = Str::camel('nice_game'); print_r($camel2); // output - niceGame $camel3 = Str::camel('super_code'); print_r($camel3); // output - superCode } } |
Output:-
1 2 3 4 5 |
fooBar niceGame superCode |