Hello i will ask directly with out explaining, how can i close this echo ???

    echo "<div class='date'> date("Y/m/d"); </div>";

It gives me some error like Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/a5834708/public_html/index.html on line 149
Thanks :)

Edited by Stefan_1: mistake in the code

4 Years
Discussion Span
Last Post by cereal

The problem is given by the double quotes inside the date function, you're breaking the quotes of the echoed string, if you escape them then it will print the line without executing the code.

So, you can get the output by setting a variable and include it in the string:

$date = date("Y/m/d");
echo "<div class='date'>$date</div>";
echo '<div class=\'date\'>$date</div>';

Check the output of the above example. Do you see the differences between single and double quotes? Here's the documentation:

An alternative syntax:

echo "<div class='date'>" . date("Y/m/d") . "</div>";
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.