array(array("Color", "red" ), array("Ram", "4GB" ) );
Convert this multidimensional array into a string like this
Color=red&Ram=4GB
array(array("Color", "red" ), array("Ram", "4GB" ) );
Convert this multidimensional array into a string like this
Color=red&Ram=4GB
You need to rearrange the input array a bit and then you can use http_build_query()
$sq = array(array("Color", "red" ), array("Ram", "4GB" ) );
$aa = [];
foreach( $sq as $s ) {
$aa[$s[0]] = $s[1];
}
echo http_build_query($aa);
RESULT
Color=red&Ram=4GB
Simple approach, Loop over $params and again loop for each $param then get $key $value pair concatenate them with = and store them in an array $query. last but not least join them together with &.
$params = [['color'=>'red'],['RAM'=>'4gb']];
$query = [];
foreach ($params as $param) {
foreach ($param as $key => $value) {
array_push($query, "$key=$value");
}
}
echo join("&",$query);
Result:
color=red&RAM=4gb