explode php
snippet in php

php split string

user9550

<?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

php explode function

user7599

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

php string nach zeichen zerlegen

user7524


<?php

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

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

?> 

explode php

user7036


 <?php
$str = 'one,two,three,four';
// to get all of the numbers: [one, two, three, four]
$numbers1 = explode(',',$str)
// same as $str
$numbers2 = explode(',',$str,0);
 
// breakes the string into two parts
$numbers3 = explode(',',$str,2);

// the last result will be removed
$numbers4 = explode(',',$str,-1);
?>