Reading up on PHP7, notes to self.
To concatenate strings use the . (period)
Single or double quotes
A single quote string will not expand the variable, it will simply print the string. But the value of variable inside a double quoted strings will be expanded.
Specity the end of a variable name with a curly brace
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.
appending to an array, omitting the index will append to the array.
Use list() to unpack arrays.
Headers, Redirect & Output Buffering
Before the HTML is sent to the browser the server sends a HTTP header (as do the browser to the server).
Example of an HTTP header.
The first line is the version of HTTP used followed by a status code.The header MUST come before any HTML is sent to the server. The php function header($string); is used to send a header. If we want to use the header function after page contents, we must make sure that output buffering is turned on in our php.ini file. It is also possible to enable output buffering on single pages using ob_start(); and ob_end_flush();
An example of a using the header functin to do a redirect. The exit tells the server that the script is done.
GET, POST and COOKIE
With a GET request PHP automatically takes all query parameters and put them into an associative array assigned to the super global $_GET. With a POST the parameters are assigend to the super global $_POST.