Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

How to create array from comma separated string in php

by
Category:php
php
How to create array from comma separated string in php

Often times when coding in PHP, we have the need to turn an array into a comma separated string.

try using explode function

$string = "user,admin,superadmin";
$array = explode(',', $string);
print_r($array);

Output

Array
(
    [0] => user
    [1] => admin
    [2] => superadmin
)

How to remove last comma in string using php


0 Comments


Html code work in comment box


Related Post