Heredoc and Nowdoc (also known as "here document" and "now document") are two alternative representation of strings in PHP (as double quotes and single quotes are).
This post presents these two language features and how to use them.
Heredoc and Nowdoc (also known as "here document" and "now document") are two alternative representation of strings in PHP (as double quotes and single quotes are).
This post presents these two language features and how to use them.
PHP language, like any programming language, is composed by language constructions. Beyond the basic programming structures (conditional, loop, classes syntax, functions syntax, etc), the language has some built-in functions. They are functions compiled in the core language.
There is a feature in PHP that allows to embed data (including binary data) into PHP scripts and it are not parsed by PHP interpreter. It is diferent from exit instruction, that stops script execution, but does not stop the PHP parser. The feature is provided by "__halt_compiler" instruction, that ignores all data after the point it was called.
PHP is an HTML embedded language. This means the PHP code can be inside an HTML, but should have one way to determine whether a stretch of code is PHP or HTML. The way is the use of PHP delimiters. The PHP interpreter is applicable to the stretch of code delimited by the PHP delimiters.
Some programmers use PHP code delimiters, but they do not know about their nuances. Let's see them at this post.
Callback is a feature used to pass a function/method by parameter of an other function/method. In general, a function with generic operations receives a callback by parameter and use it to do specific operations. This way, it is possible to use the specific function in diferent places.
The float type is the data type used to represent floating point numbers. In PHP, as in other programming languages, the float type has limits, so precision might be lost. In any case, I will explain that in this article.
Do you really know the integer type of PHP? It represents a integer number. Well, but we are not here to know what everybody already know. Let's explore something more interesting.