Reputation: 3240
print_r($arraydata);
I got output
Array ( [0] => vikas [1] => shirt [2] => cloth1 [3] => test [4] => shirt [5] => cloth2 [6] => avi )
i need to show array like that
$arr = array("vikas","shirt","cloth1","test","shirt","cloth2","avi");
Upvotes: 10
Views: 26793
Reputation: 2316
If comma separation is necessary:
echo '$arr = array(';
foreach ($array as $key => $value) {
if ($key > 0) echo ',';
echo '"'.$value.'"';
}
echo ');';
Upvotes: 0
Reputation: 2016
Use this :
echo '$arr = array("'.implode('", "', $arraydata).'");';
Upvotes: 16