Say you have an array like this...
username, password, email
and you need to assign a value to each element. After, this needs to be formatted into a string like this:
username=someRandomValueAssigned&password=someRandomValueAssigned&email=someRandomValueAssigned
how would I do this? Thanks.
array_combine will return an associative array like,
then the result you want can be achieved using a simple foreach loop
Also, I suspect you are trying to build a url so you might want to check out php's http_build_query function
Looks like you're building a query string, I think you want to use
http_build_query()
:This should give you the result you're looking for.
http://php.net/manual/function.http-build-query.php