Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Popular String Functions: Open-Source Examples

Premium
4 min read

There are many functions for working with strings. Let's check some of them and how they are used in Laravel open-source projects.


str_replace()

class HomeController extends Controller
{
// ...
 
public function pastebin(string $paste = ''): RedirectResponse
{
$paste = str_replace(PHP_EOL, '', $paste);
 
return redirect()->away("https://paste.laravel.io/$paste");
}
}

Link to the example in GitHub repository.


explode()

The explode function is one of the most popular functions. This function returns...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 14 min)

You also get:

54 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

L
lawries ✓ Link copied!

Great article - thanks