So once again, a variable can be given any of the following values, any of the following ways:
| PHP-Code: |
//Numbers: |
A variable can hold a letter or any number.
Strings hold long "strings" of letters or numbers - like as a sentence. All of the following are strings:
Sentences:
| PHP-Code: |
$string1 = "Welcome to Learnphpfree.com"; |
You will be doing a lot with strings so make sure and practice with them on your own so that you know them well.
Control Structures are the logic of the code. Remember that if the "if" is FALSE than PHP while run the "else" statement, but if the "if" is true PHP will ignore the "else" statement.
Remember that these characters dictate the control structure:
| Code: |
">" means "Greater than" "<" means "less than" "==" means "value is equal" "=" means "make equal" "&&" means "and" "||" means "or" "+" means "plus" "-" means "minus" "!" means "NOT" "!=" means "NOT equal" ">+" means "Greater than or equal to" |
Here are a couple simple ones:
| PHP-Code: |
if (1 > 0) { |
ADVANCED LOOPS:
For "&&" both have to be TRUE for the "if" to be true.
For "||" only one has to be TRUE for the "if" to be true.
| PHP-Code: |
if ((1 > 0) && (2 > 0)) { |
Last I would like YOU to try to make your own "if" statements and try making and messing with strings and variables too! ]Here is a zip archive of the loops, variables, and strings files. Upload them to your own site and experiment changing them. You need to make sure you understand them well.
No comments:
Post a Comment