PHP/Variables: Difference between revisions

No edit summary
Line 3: Line 3:
Variables, as mentioned briefly in [[Introduction to PHP]], are significant for any programming language. They can be used to store all forms of data, and are generally required to perform multiple manipulations on data not hard-coded into a script. This lesson will introduce the basics of variables in PHP.
Variables, as mentioned briefly in [[Introduction to PHP]], are significant for any programming language. They can be used to store all forms of data, and are generally required to perform multiple manipulations on data not hard-coded into a script. This lesson will introduce the basics of variables in PHP.


== Basic syntax ==
== AMFG!! I LIKE PWNED YOUR ASS NIGGA==
In PHP, all variables are denoted by the $ at the beginning of their identifier. They do not need to be declared; they can simply be assigned a value and used from there on. Variables name should start with a lowercase letter; this is not required but (in certain php configurations) prevents clashes with autoglobals (which will be explained later). Here is a basic example of assigning a value to a variable and printing its value onto the page:
In PHP, all variables are denoted by the $ at the beginning of their identifier. They do not need to be declared; they can simply be assigned a value and used from there on. Variables name should start with a lowercase letter; this is not required but (in certain php configurations) prevents clashes with autoglobals (which will be explained later). Here is a basic example of assigning a value to a variable and printing its value onto the page: