Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
<?php $product = 'Widget'; $price = 9.99; // Heredoc — variables ARE interpolated $html = <<<EOT <div class="product"> <h2>$product</h2> <p>Price: \$$price</p> </div> EOT; echo $html; // Nowdoc — NO interpolation (ideal for code snippets or SQL) $sql = <<<'SQL' SELECT * FROM products WHERE price < $price SQL; echo $sql; // Output contains literal "$price", not 9.99 // Useful for embedding HTML in mailers, templates, etc. function emailBody(string $name): string { return <<<EOT Hello, $name! Welcome to our platform. EOT; }
Result
Open