I know this is going to be straight forward but its also impossible to search for...
what is the correct term / name for this 3 arrow thing - e.g.
<<< HTML
Thanks!
I know this is going to be straight forward but its also impossible to search for...
what is the correct term / name for this 3 arrow thing - e.g.
<<< HTML
Thanks!
${ }
(dollar sign curly bracket) is known as Simple syntax.
It provides a way to embed a variable, an array value, or an object property in a string with a minimum of effort.
If a dollar sign ($) is encountered, the parser will greedily take as many tokens as possible to form a valid variable name. Enclose the variable name in curly braces to explicitly specify the end of the name.
<?php $juice = "apple"; echo "He drank some $juice juice.".PHP_EOL; // Invalid. "s" is a valid character for a variable name, but the variable is $juice. echo "He drank some juice made of $juices."; // Valid. Explicitly specify the end of the variable name by enclosing it in braces: echo "He drank some juice made of ${juice}s."; ?>
The above example will output:
He drank some apple juice. He drank some juice made of . He drank some juice made of apples.
global
is a keyword that should be used by itself. It must not be combined with an assignment. So, chop it:
global $x;
$x = 42;
Also, as Zenham mentions, global
is used inside functions, to access variables in an outer scope. So the use of global
as it is presented makes little sense.
Another tip (though it will not really help you with syntax errors): add the following line to the top of the main file, to help debugging (documentation):
error_reporting(E_ALL);
It should probably be called a "colon colon separator":
::
as a separator.*source: the road to lambda @ Javaone 2013 around 04:00.
It's the same operator with different names based on the usage.
Rest Properties
Rest properties collect the remaining own enumerable property keys that are not already picked off by the destructuring pattern. Those keys and their values are copied onto a new object.
let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
x; // 1
y; // 2
z; // { a: 3, b: 4 }
Spread Properties
Spread properties in object initializers copies own enumerable properties from a provided object onto the newly created object.
let n = { x, y, ...z };
n; // { x: 1, y: 2, a: 3, b: 4 }
more ...
Heredoc: