I have an array like this:
Array (
[3] => 15
[30] => 1
[1] => 1 )
I want to convert it into a string like this: $string = "3:15;30:1;1:1;"
Thanks you in advance
I have an array like this:
Array (
[3] => 15
[30] => 1
[1] => 1 )
I want to convert it into a string like this: $string = "3:15;30:1;1:1;"
Thanks you in advance
Given your array, $array
:
$str = '';
foreach ($array as $k => $v) {
$str .= $k . ':' . $v . ';';
}
echo $str; // 3:15;30:1;1:1;