PHP

  minte9
REMEMBERS




Last update:   28-03-2022

Quotes

Ony with double quotes, variables are interpreted and replaced.
 
$a = 'n';
echo '$a';  // $a

$b = 'n';
echo "$b";  // n

Herodoc

It is used for formating on multiple lines.
 
/**
 * Herodoc strings
 * 
 * It is used for formating on multiple lines. 
 * You can use quotes without escaping.
 * 
 * The closing identifier must contain no characters, except a semicolon (;)
 * The first character after the closing identifier must be a newline. 
 */

$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
*/

Questions     github Basics
Constants
        A B C D E F
🔔
1/2