- Php
- Basics
- Quotes ♣
- Constants
- Control Structures
- Reference
- Number Systems
- Variables
- Definition
- Variable Variable
- Exists
- Type Casting
- Operators
- Aritmetic
- Bitwise
- String
- Comparison
- Logical
- Function
- Definition
- Anonymous
- Reference
- Variable Arguments
- Array
- Basics
- Operations
- Create
- Search
- Modify
- Sort
- Storage
- String
- String Basics
- String Compare
- String Search
- String Replace
- String Format
- String Regexp
- String Parse
- Formating
- Json
- Streams
- File Open
- Read File
- Read Csv
- File Contents
- Context
- Ob_start
- OOP
- Object Instantiation
- Class Constructor
- Interfaces, Abstract
- Resource Visibility
- Class Constants
- Namespaces
- HTTP
- Headers
- File Uploads
- Cookies
- Sessions
Click to Flip Card
Basics / Quotes
Variables are interpreted when double quotes are used. Herodoc format is used for formating on multiple lines.
When are variable interpreted and replaced? How can you format on multiple lines?
Quotes
Variables are interpreted and replaced, but only with double quotes.
$a = 4;
echo '$a'; // $a
echo "$a"; // 4
Herodoc
Herodoc format 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
*/