PHP variables
Guilty Of PHP articles about PHP variables
8 articles
-
Understand PHP execution and behavior
Avoid Misreading PHP Assignment Results and Operator Precedence
Trace a subtotal through arithmetic and assignment, then use parentheses to make numeric-string comparisons and logical assignments easier to read.
-
Define a PHP Function That Takes Arguments and Returns a Value
Build a reusable line-total calculation, then follow two calls from their supplied numbers through the function and back to the caller.
-
Create a PHP Class and Call Its Method on Two Objects
Define one Greeting class, give two instances different names, and trace how the same method reads each object's property.
-
Declare PHP Constants and Read Them Alongside Variables in Functions
Use one example to compare a reassigned variable with constants declared by const and define(), then see how the function uses global for the variable but not the constants.
-
Understand PHP execution and behavior
Where Can You Read a PHP Variable After a Loop or Function?
An if statement or loop leaves variables in the surrounding scope, while a function has its own scope. Examples show how to pass values in, bind them in an arrow function, and retain a static local.
-
Configure PHP and connected services
Set PHP variables_order to Populate the Superglobals You Need
Decode EGPCS and GPCS, check the value your application actually uses, and test input arrays without assuming $_REQUEST follows variables_order.
-
Put a PHP Variable Next to Text Without Changing Its Name
Use double quotes for a straightforward variable, braces when a suffix touches its name, or concatenation to join quoted fragments around its value.
-
Tell Numbers from Strings When Assigning PHP Variables
Assign whole-number, decimal and quoted-digit values, then use var_dump() to inspect them and compare one variable before and after reassignment.
