Kenny Kiriga Kenny Kiriga - 1 month ago 7
HTML Question

Echoing variable in php

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>

Answer

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

<h1><?= "$info[0] ($info[1])"; ?></h1>
Comments