Skip to content

Instantly share code, notes, and snippets.

@cp6
Created October 17, 2020 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cp6/65deeb875e803c40a729cd555ab39ebe to your computer and use it in GitHub Desktop.
Save cp6/65deeb875e803c40a729cd555ab39ebe to your computer and use it in GitHub Desktop.
PHP build URL from GET paramaters
<?php
$params = $_GET;
$count = 0;
foreach ($params as $key => $value) {
if ($count === 0) {
echo "?{$key}={$value}";
} else {
echo "&{$key}={$value}";
}
//echo "$key : $value<br>";
$count++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment