For week 6, we learned about PHP which is one of the server-side script language. PHP scripts can be embedded within HTML to create dynamic and interactive web pages. PHP is an open source, easy to use, can be installed in multiple platforms and database supported.
PHP Basic Syntax
<?php PHP code goes here ?>
<? PHP code goes here ?>
<script language=“php”
PHP
code goes here </script>
PHP basics include:
1. Variables and Data Types - must begin with a $
- they are case sensitive
- Loosely typed language. It can be a number(integer/floating point) or a string of text or Boolean values.
Comparison Operators |
Arithmetic Operators |
Logical Operators |
3. Conditional Statements and Loops
- if statement
- if-else and elseif statement
- switch statement
- for loop
- while loop
- do-while loop
4. Functions
- A function is a piece of PHP code that perform a useful task, and usually return a value related to that task.
- it can be executed once or many times by the PHP script.
- An array is a variable that can contain multiple values under a single variable name.
- It is useful for storing a group of related values.
No comments:
Post a Comment