PHP Heredoc

PHP Heredoc

PHP heredoc syntax allows creating multiple lines of string without using quotations.

Example:
Here, the heredoc starts with <<< operator and the multiple lines are followed. <<<identifier_name is used as an identifier making the start of heredoc. To end the heredoc, the identifier is written again.
<?php
$str = <<<Sample
This is a sample string
A sample string
Sample;
Echo $str;
?>
PHP variables
Variables in PHP, like in all languages are used for storing values. All variables in PHP start with a $ sign.
PHP comment
Single line - Ways to comments, Multiple lines – Ways to comment
PHP conditional statement
PHP – if: If the expression is evaluated to true, the condition.
Post your comment

You may like