2. Echo PHP Function, PHP Variables, If and Switch Statements

Echo Function :
  • The echo() function outputs one or more strings.
  • Syntax: echo(strings);
  • Ex. echo "Hello World!";
http://pastebin.com/b9xc54uc
Variables in PHP :
  • Variables are used for storing values, like text strings, numbers or arrays.
  • When a variable is declared, it can be used over and over again in your script.
  • All variables in PHP start with a $ sign symbol.
  • The correct way of declaring a variable in PHP: $var_name = value;
http://pastebin.com/aBkwyB4K
 If Statement :
  • if statement - use this statement to execute some code only if a specified condition is true.
  • if...else statement - use this statement to execute some code if a condition is true and another code if the condition is false.
  • if...elseif....else statement - use this statement to select one of several blocks of code to be executed.
http://pastebin.com/WQMGVtjz
Switch Statement :
  • switch statement - use this statement to select one of many blocks of code to be executed
http://pastebin.com/mGngHSsq

0 comments:

Post a Comment