Hi everyone,


I need to use the same block of code in multiple places on the same page. Can I assign the following code to a variable, or is a function more appropriate or perhaps heredoc? It is just to simplify things and reduce the possibility of errors.


Thank you very much!!!


PHP Code:
if (isset($name)){
echo 
'&name='.$name.'';
}
elseif(isset(
$_GET['name'])) {
$getname explode(','$_GET['name']); 
foreach (
$getname as $key => $value) {
          echo 
'&name='.$value.'';
}