Ensuring Technical Readiness For Copilot in Microsoft 365
Introduction to PHP - What is PHP? Basic Syntax, Variables, Operators & Control Structures
1. Introduction to PHP Todd Barber IT Analyst III / University Webmaster Information Technology Services
2.
3.
4.
5.
6.
7.
8.
9.
10. Operator Precedence Associativity Operators Additional Information non-associative new new left [ array() non-associative ++ -- increment/decrement non-associative ~ - (int) (float) (string) (array) (object) @ types non-associative instanceof types right ! logical left * / % arithmetic left + - . arithmetic and string left << >> bitwise non-associative < <= > >= comparison non-associative == != === !== comparison left & bitwise and references left ^ bitwise left | bitwise left && logical left || logical left ? : ternary right = += -= *= /= .= %= &= |= ^= <<= >>= assignment left and logical left xor logical left or logical left , (comma) many uses
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26. More switch <?php $i = 4; switch ($i) { case 0: case 1: case 2: case 3: echo “I is less than 4”; break; case 4: echo “I is equal to 4”; break; default: echo “I is greater than 4”; break; ?> Combining cases Omitting Breaks <?php $i = 4; switch ($i) { case 0: case 1: case 2: case 3: echo “I is less than 4”; case 4: echo “I is equal to 4”; default: echo “I is greater than 4”; ?>
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
Notes de l'éditeur
Since everything is HTML embedded, must have a way of telling the server what is PHP and what is HTML. 1 and 2 are both always available, however number 1 is used most often. 3 and 4 are only available if enabled by the server administrator. Closing tag is optional. Lines of code must end in PHP.
Don’t add scope until talking about functions b/c examples don’t make sense until then.
Don’t add scope until talking about functions b/c examples don’t make sense until then.
Form with 8 names and name1, name2, etc… and it gets submitted For loop 8 times: $temp_name = name$i echo $$temp_name // holds the actual value from the form. End of for
String to number- if string starts with number or sign then it gets that value, if it starts with anything else it gets evaluated to zero.
Two different variations of AND and OR because they have different precedence
Point out that on single command if statements the curly braces are optional.
for ($i=1;$i<=10;print $i++) More on for the expressions can be blank or have multiple expressions in them. Go to php.net for more