php split string
snippet in php

php split string along spaces

user2014

// Example 1
$pizza  = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2

php split string

user6922

<?php
// It doesnt get any better than this Example
$pizza  = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2

split string in c#

user4536

$colors  = "red,blue,green,orange";
$colorsArray = explode(",", $colors);

php split string

user705


<?php

$str = "Hello world. It's a beautiful day.";

print_r (explode(" ",$str));

?>