Monday, January 7, 2008

Top 10 fundamental PHP command to know for the Internet

Having had the computers set up with CentOS 5.1 last week, I am now prepared for the “PHP and MySQL database” training. Students started coming in at 8:00 AM today and some do not have practical programming skills.

There are many approaches to learning PHP. I find that the following are essential foundations
  1. Single and multi line comments.
  2. PHP files will usually have the extensions .php but there may be exceptions where the web server is set to use alternative extensions.
  3. Assigning and using variables. Variables can be in the form of numeric, strings or arrays and always begin with \$.
  4. 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.
  5. Sending HTML characters to the web server with echo and print commands.
  6. Sorting arrays with sort, by the values only (asort) or by the keys (ksort). Sorting can be done in the reverse too.
  7. Using loops to run statements is useful for repetitive task. Commands like while, do...while, for and foreach is rather useful.
  8. 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.
  9. User defined functions can be declared any where before it is called.
  10. 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.
Knowing the above sets things right and you are ready to start PHP programming.

No comments:

Blog Archive