如何在数组中分离和存储数据?

Sar*_*gya 0 php arrays

我有一个数据库字段,其中有记录,以分号";"分隔.现在我很容易获取整个数据,但我如何将它们分开并存储在一个数组中.

示例: data : abc;def;ghi;

我需要在数组等中获取这些值array[0]=abc; array[1] = def,等等....

Ign*_*nas 8

尝试使用爆炸:

<?php
$string = "abc;def;ghi;";
$array = explode(";", $string);
print_r($array); // will display the array with [0] => abc, [1] => def etc..
?>
Run Code Online (Sandbox Code Playgroud)