I need to remove keys from my arrays, and array be like
Array ( [0] => 23/2 [1] => KG Halli [2] => D' Souza Layout [3] => Sampangi Rama Nagar [4] => Bengaluru [5] => Bangalore Urban [6] => Karnataka [7] => India [8] => 560001 )
and i need it as
23/2, KG Halli, D' Souza Layout, Sampangi Rama Nagar, Bengaluru, Banglore Urban
php implode() function is the answer to your question
You can use implode to make your array values as a string and attach each value with any separator i.e. ',' or a space.
implode(', ', ARRAY);
$required_str = implode(',',$array);
Try this:
$yourString = implode(", ", $yourArray);
use string function implode()
$arr = array('23/2','KG Halli',"D' Souza Layout",'Sampangi Rama Nagar' ,'Bengaluru','Bangalore Urban','Karnataka', 'India',560001);
echo implode(",",$arr);
You can use implode() php function to make an array to string
Just like this
$array=['id'=>12,'no'=>1234]
$String = implode(", ", $array);//it give o/p as "12,1234"
Or if you want array with no key value then you can use array_values() Just like this
$array=array_values($array);//it give o/p as [12,1234]
Simply use the implode()
function of PHP.
Example: implode(', ', $your_arr);