I have a file swifts.php with code (I have written this after a lot of research)
<?php
$swift= array(
'PBANUA2XXXX' => 'PRIVATBANK',
'Swift2' => 'word2',
'Swift3' => 'word3',
'Swift4' => 'word4',
'Swift5' => 'word5',
'etc' => 'word6',
'etc..' => 'word7',
);
echo http_build_query($swift) . "\n";
echo http_build_query($swift, '', '&');
?>
My question is how to receive a string for example when I request the Swift3 with https://example.com/swifts.php?swift=Swift3 I want to receive in a page just the string word3 but it shows me all the arrays like: PBANUA2XXXX=PRIVATBANK&Swift2=word2&Swift3=word3& etc etc....
How I can get what I request?
You have to get query string by using $_GET
.
Then use your array to get value
echo $swift[$_GET['swift']]; // as $_GET['swift'] = Swift3
so $swift[$_GET['swift']] = 'word3';