1) { $explode[0] = trim($explode[0]); $explode[0] = '&'.substr($explode[0], 1, strlen($explode[0])); $explode[1] = trim($explode[1]); $explode[1] = substr($explode[1], 0, strlen($explode[1]) - 1); $explode[1] = str_replace('"', '', $explode[1]); $temp[] = $explode[0].'='.$explode[1]; } } foreach ($temp as $value) { echo $value.' '; }