In a variable, the value is:

1;2;3;4;5;6; 

Those. Items are separated by a semicolon. I need these elements to be enrolled in the appropriate cell of the array. Who can help with the implementation?

    2 answers 2

     $var = '1;2;3;4;5;6'; $row = explode(';', $var); echo "<pre>"; print_r($row); echo "</pre>"; 
    • faic palm, in explode separator is transmitted first and not the variable ... - Zowie
    • explode there values ​​only change places and prince everything works, ATP =) - Manitikyl
    • yes, but the author of the answer to change was not embarrassed ... - Zowie
    • no matter =) and another question, but how can you determine the length of $ row? well i find out how many e-s turned out in it? - Manitikyl
    • count ($ row); - Vitaly Kustov

    you should be ashamed of such questions ..

    even try to look for the answer in the net ..

    http://www.php.net/manual/en/ref.strings.php - for working with strings

    http://www.php.net/manual/en/ref.array.php - for working with arrays