Question User Question User - 1 year ago 90
PHP Question

add the key name and value for the same array in php

I have some array like this how can i split the key and value in php ?

[A0E4NL014XVM273] => Array
[0] => qexixdb

[A0E4UK024XVM014_Clone] => Array
[0] => pe8w3100
[1] => pe8w3100

Tried Query

foreach($vm_array as $vmkey=> $vmvalue){
$varray[] = $vmvalue;
/*foreach($vmvalue as $vmvalue=> $vmvalufmarray){
$vm_array[$vmkey][] = $vmvalufmarray.',';

Expected Output

[A0E4UK024XVM014_Clone] => pe8w3100,pe8w3100

Answer Source

You need to make a function called implode().

foreach($vm_array  as $vmkey=> $vmvalue){
    $varray[$vmkey] = implode(",", $vmvalue);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download