<button
class="add-item"
data-item-id="2"
data-item-name="Bacon"
data-item-price="3.00"
data-item-weight="20"
data-item-url="http://mysite.com/products/bacon"
data-item-description="Some fresh bacon">
Buy bacon
</button>
<?php
$id = 2;
$item_name = "cheese";
$item_price = 3.00;
$item_weight = 20;
$item_description = "Chedder Cheese";
?>
ASKER
ASKER
Why would you recommend HEREDOC ?
$name = "Julian";
$mystring = 'My name is "{$name}" and my neighbour\'s name is Fred';
Will output
My name is "{$name}" and my neighbour's name is Fred
Note the escape '\' is not in the output$name = "Julian";
$mystring = "My name is \"{$name}\" and my neighbour's name is Fred";
Will output
My name is "Julian" and my neighbour's name is Fred
$name = "Julian";
$mystring = <<< ARBITARYTAG
My name is "{$name}" and my neighbour's name is Fred
ARBITARYTAG;
ASKER
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY
Open in new window