• heredoc syntax

      0 comments

    “heredoc” syntax can be used to declare complex strings,

    What will out put the following code snippet?

    <?php
    $who = "questions";
    echo <<<TEXT
    So I said, "php interview $who"
    TEXT;
    ?>

    Answer – So I said, “php interview questions”

    In general, the functionality of this heredoc syntax is similar to double quotes.

  • variable interpolation

      2 comments


    Using variable interpolation how we can print the following String?

    “I am visiting the php interview questions website”.
    The word “question” is inside a variable,
    $a = ‘question’;

    Answer is just,
    echo “I am visiting the php interview {$a}s website”;