There are many approaches to learning PHP. I find that the following are essential foundations
- Single and multi line comments.
- PHP files will usually have the extensions .php but there may be exceptions where the web server is set to use alternative extensions.
- Assigning and using variables. Variables can be in the form of numeric, strings or arrays and always begin with \$.
- Use of string functions to manipulate the string values. Some of the common functions are strlen – display the string length, strpos – display the string position in the array, strstr – finding a string within a string, substr – retrieve portions of a string.
- Sending HTML characters to the web server with echo and print commands.
- Sorting arrays with sort, by the values only (asort) or by the keys (ksort). Sorting can be done in the reverse too.
- Using loops to run statements is useful for repetitive task. Commands like while, do...while, for and foreach is rather useful.
- Conditional statements allow decisions to be made to run specific statements under certain conditions. Statements like if...elseif...else... and the switch is easy to understand.
- User defined functions can be declared any where before it is called.
- User input is through HTML form elements. PHP can use any of the following commands to retrieve the user input; $_POST, $_GET and $_ REQUEST arrays variables.
No comments:
Post a Comment