I want to do this for 5 sets of parameters is this the best way to do it or is there some simpler syntax?
if(isset($_GET[\'credentials\'])) $credentials = $_
PHP 7 introduced the The null coalescing operator (??), which you can use like this:
$result = $var ?? 'default';
This will assign default to result if:
$var is undefined.$var is NULLYou can also use multiple ?? operators:
$result = $null_var ?? $undefined_var ?? 'hello' ?? 'world'; // Result: hello
To answer your question, you should be doing something like:
$credentials = $_GET['c'] ?? $_POST['c'] ?? $_POST['credentials'] ?? $_GET['credentials'];
More details here and here