I need to cut words after ", "
in PHP
I have something similar to this $string = "dato, dato, dato"
, it's the same name only that is repeated.
I need to cut words after ", "
in PHP
I have something similar to this $string = "dato, dato, dato"
, it's the same name only that is repeated.
You can use explode to divide a string into several string. Description:
array explode ( string $delimiter , string $string [, int $limit = PHP_INT_MAX ] )
delimiter: The delimiting string.
string: The input string.
For example:
$string = 'dato1, dato2, dato3';
$datos = explode(", ", $string);
var_dump($datos);
Exit:
array(3) { [0]=> string(5) "dato1" [1]=> string(5) "dato2" [2]=> string(5) "dato3" }