This is the second part of a tutorial series on PHP. In this episode, we will look at the basic rules for writing variables. This page is just a quick overview. If you're looking for a detailed technical description of all the features, I've written…
Superglobal variables are used to pass global application state and HTTP communication. The main advantage of these variables is that they are always and everywhere available. In practice, they are arrays of values where we access specific informatio…
All data processed in PHP is of a certain type. For example, an integer, a string or a boolean (true/false). Basic data types Basic types are also called primitive data types, or scalar types. Type Name Description int Integer (integer) Contains only…
Warning: This article was written many years ago and some information may be outdated or incorrect. Please bear this in mind when reading. Variables are not intended for common deployment (they solve problems that can be solved in other ways), they a…
Global variables are available at any time in any part of the application and do not need to be passed. Warning: A well-designed application should not use global variables because they violate the encapsulation principle and can cause hard-to-detect…
Local variables are valid only inside the body of function or method (in object-oriented programming). If we are working in the context of a regular script, everything happens as expected: $x = 5; echo $x; // prints 5 But when we define our own funct…
This page is a complete summary of how variables work in PHP. The text is written in a slightly technical style and may not be fully understood by beginners. If you're interested in the complete basics, then read the beginner's tutorial and principle…