Question
I am developing a project in which i need to make the URLs of pages and when the user submits the title of pages and title’s space should be replaced with “-” so that it can be in correct format such as how-to-replace-space-with-dash-in-laravel
Answer
Sometime you might need to replace some thing with any predefined things such as space “.” or any other symbol or character etc. To resolve this we need to use PHP function str_replace()
$str=Str::replace(' ','-' ,$request->title);
Ravindra is a passionate full stack developer and dedicated blogger with a flair for crafting user-friendly web applications and insightful articles. With expertise spanning front-end and back-end technologies, Ravindra brings ideas to life through innovative coding solutions.