PROGRAMMING

MINTE9
REMEMBERS




Last update:   23-07-2021

Quotes

! With single quotes, variables are NOT interpreted and replaced. With double quotes, variables are interpreted and replaced.
 RunCode
$a = 'a';
echo $b = '$an'; // outputs $an

$a = 'a';
echo $b = "$an"; // output a

Herodoc

! It is used for formating on multiple lines. You can use of quotes without escaping. The closing identifier must contain no characters, except a semicolon (;). Also, the first character after the closing identifier must be a newline.
 RunCode
$who = "John";
$output = <<<TEST
    She said "This is $who's test"
    on multiple rows
TEST;

echo nl2br($output);
/* 
    She said "This is John's test"
    on multiple rows
*/
... 4 lines
˄˄˄
Task

 CompleteTask
/**
 * Define $output on multiple $lines
 * Use Herodoc syntax.
 *
 * output =
 *      She said "This is John's test"
 *      on multiple rows
 */

$who = "John";
$output = ...
solution code
Questions    
2. Constants
01 . Quotes
Last update:   23-07-2021

        A B C D E F
🔔
1/4