1

Essentially I am trying to have a heading using what is below. Not sure what is going on but nothing happens. Even when I do something as simple as echo "hello" there instead of the 2 variables.

<h1><?echo "$info[0] ($info[1])";?></h1>
Kenny Kiriga
  • 39
  • 1
  • 5
  • 3
    Do you have short tags enabled? Your php may require `` – Marc B Oct 17 '16 at 16:39
  • If you have php 5.4 in *php.ini* the shorthand version of php echo. `= "$info[0] ($info[1])" ?>` is enabled by default. [more info here](http://stackoverflow.com/questions/2020445/what-does-mean-in-php) – Mihailo Oct 17 '16 at 16:46
  • Something must be wrong with $info variable. I ran your line and works fine. $info = array( "hello", "there" ); ?>

    – Svet Oct 17 '16 at 16:54

2 Answers2

0

Try using this way. You are missing <?php.

<h1> <?php echo $info[0] .'('. $info[1] .')'; ?> </h1>
chalitha geekiyanage
  • 6,464
  • 5
  • 25
  • 32
0

You can use <?= ?> shorthand for echoing variables and the code should look like,

<h1><?= "$info[0] ($info[1])"; ?></h1>
Khorshed Alam
  • 2,667
  • 22
  • 31