Ylama
Ylama

Reputation: 2489

Using special characters within php echo

i use an if function to display copy but this copy has to be wrapped in double quotes, and i cant get it working. any help please.

Code

 $currentpage = $_SERVER['REQUEST_URI'];

if ($currentpage == "/room/penthouse-suite/"){
echo "<div class='text-center text-emphasis text-lg'>"test penthouse"</div>";
}

so on my page it should display ---> "test penthouse"

Upvotes: 0

Views: 2953

Answers (1)

Ian
Ian

Reputation: 3676

You can simply escape the characters by using a backslash.

$currentpage = $_SERVER['REQUEST_URI'];

if ($currentpage == "/room/penthouse-suite/"){
    echo "<div class='text-center text-emphasis text-lg'>\"test penthouse\"</div>";
}

Upvotes: 5

Related Questions