New in Laravel from 9.7 squish helper.
$result = Str::squish(' Hello John, how are you? ');// Hello John, how are you?
Tip given by @mattkingshott
Enjoyed This Tip?
Get access to all premium tutorials, video and text courses, and exclusive Laravel resources. Join our community of 10,000+ developers.
Recent Courses on Laravel Daily
Laravel Boost: Deeper Practical Dive
8 lessons
32 min
Mobile Apps: React Native vs Flutter vs NativePHP?
8 lessons
55 min
Roles and Permissions in Laravel 13
14 lessons
57 min