The function you are looking for is 'explode'.  It works like this, say you
have a line of text stored in line of say pizza topping like this:
$pizza_toppings = "topping1,topping2,topping3"
and now you want the toppings in an array just do this:
$toppings = explode(",", $pizza_toppings);
then you will have an array $toppings with entries for each of the toppings.
Hope this helps.


Simos Varelakis wrote:

> Hi to everyone
> i have the following problem
> i have a string  $foo which contains (n variable) comma separated values
> (example  "1,17,23,45")
> and i want to insert these values in a mysql table . The destination field
> is int type and i need to insert  one record per value
> Do you know which php function(s) should i use in order to (loop -extract
> the values from string) and  do that ??
> Thanks in advance for your help
> regars
> simos

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to