- implode: documentation ( source)
<?php
function convertAssociativeArrayToValue( array $data )
{
$result = [];
foreach( $data as $key => $value )
{
//
if( is_array( $value ) )
{
if( ! array_key_exists( 0, $value ) ) {
$string = implode( ',', convertAssociativeArrayToValue( $value ) );
}
else {
$string = implode( ',', $values );
}
$value = "[" . $string . "]";
}
$result[] = "{$key}:{$value}";
}
return $result;
}