Learn Codeigniter

Convert String into Array In PHP

We will use explode() Function to convert String into Array.

Example

<?php
$string='first,second,third,fourth';
$array=explode(',',$string);//Converts String in Array
print_r($array);
?>

Output

Array ([0] => first [1] => second [2] => third [3] => fourth )