javascript - How to add quotation marks in a string? -
hi have array using code below
var selectedvalues=new array(); selectedvalues=divisi.split(",");
and result is
itd, ito, keuangan, sumber daya manusia
but want have result
"itd", "ito", "keuangan", "sumber daya manusia"
do know how make that? thankyou
the split return array of strings itself, if question. http://php.net/manual/en/function.split.php
edit: adding more detailed answer:
<?php $divisi = "itd, ito, keuangan, sumber daya manusia"; $selectedvalues = array(); $selectedvalues = split(",", $divisi); var_dump($selectedvalues) ?>
the script above returns below array when run on http://phpfiddle.org/
array(4) { [0]=> string(3) "itd" [1]=> string(4) " ito" [2]=> string(9) " keuangan" [3]=> string(20) " sumber daya manusia" }
as pointed out split
deprecated: http://php.net/manual/en/function.split.php. please use explode
or str_split
also code looks javascript , not proper php. take care of that.