Debug School

rakesh kumar
rakesh kumar

Posted on

Laravel String Method

laravel split string by space
laravel split string by comma
Split string in Laravel Framework

laravel split string by space

// Example 1

$pizza  = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2
explode(" ","Geeks for Geeks")
Enter fullscreen mode Exit fullscreen mode

click here

laravel split string by comma

$myString = "9,admin@example.com,8";
$myArray = explode(',', $myString);
print_r($myArray);
Enter fullscreen mode Exit fullscreen mode

click here

Split string in Laravel Framework

click here

Top comments (0)