0

I have $Page1Title declared in a config file and I have $PageID declared on each individual page. How would I go about echoing the $Page1Title variable using the $PageID variable? Almost like this $PageTitle = $Page{$PageID}Title; type of thing?!

UPDATE:

Sorted it with

$PageTitle = 'Page'.$PageID.'Title';
<?=$$PageTitle?>
BN83
  • 902
  • 3
  • 9
  • 29
  • Instead of [variable variables](http://php.net/manual/en/language.variables.variable.php), you might want to consider an array for that - in particular since the `1` indicates a list. – mario Aug 26 '16 at 11:45

1 Answers1

0

You can use var of var

$var = 'Page' . $i . 'Title';
echo $$var;
Sylwit
  • 1,497
  • 1
  • 11
  • 20