Ovie Dev
Ovie Dev

Reputation: 55

Overwrite HTML with PHP

I want to overwrite html code by php based on a variable. How can I do that? My code:

$variable = true;
if(!$variable)
{
    //send this html code to the client
}
//if that condition is false - do nothing (aka display normal content)

Upvotes: 1

Views: 211

Answers (1)

Bart Friederichs
Bart Friederichs

Reputation: 33533

You cannot "overwrite" HTML code. Once it is sent, there is nothing you can do about it (I'll leave output buffering out of context now).

What you want though is covered an all PHP tutorials out there, so you should be able to figure this out yourself. If you have done that research and are still struggling, feel free to ask again here.

But, to give you a hint, check out else, or die().

Upvotes: 1

Related Questions