Home » , , » [array without keys] Create Array Without Keys From Comma Separated String Using PHP

[array without keys] Create Array Without Keys From Comma Separated String Using PHP

Written By Unknown on Monday 3 August 2015 | 17:44

You can't have an array without keys. But there is workaround to make it possible.
Grab the comma separated string and use explode function to create array. Use the implode function on resulting array, and you will get the nice array without keys.
Example

 $strings = "my, name, is, Anup"; $arraydata = explode(",", trim($strings)); echo '$arr = array("'.implode('", "', $arraydata).'");'; //output // $arr = array("my", "name", "is", "Anup"); 

0 comments:

Post a Comment

 
D.M.C.A Disclaimer - All contents published under GNU General Public License.
We does not upload or host any files on this website.
Copyright © 2015. MAYDANG
Proudly powered by Blogger