Parsing input string

The value of the variable is:

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

I.e. elements are separated by semicolons. I need these elements to be written to the corresponding array cell. Who can help with the implementation?


Answer 1, authority 100%

You should be ashamed of yourself for asking such questions..

at least try to look for the answer on 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


Answer 2, authority 33%

$var = '1;2;3;4;5;6';
$row = explode(';', $var);
echo "<pre>";
print_r($row);
echo "</pre>";