How do i write an email with php in it?

I am sending an email with PHP and i want the email sent to have PHP in it but for some reason it doesn’t work. How can i include PHP in the email sent?
This is the code that writes the email

Answer

You can’t have php in an email, because emails can only have valid html/css code. What you want in your example is something like this:

$txt = '<th>' . $example . '</th>';

An alternative method of doing it would be as follows:

$txt = "<th> $example </th>";

In PHP, double quotation marks allow you to shove variables into the string and it automatically injects them in there. Speed difference is negligible, so you can use whichever fits your needs.