Archive for March 27th, 2007

PHP notes for Java/C# programmer - set 1

Are you a Java/C# programmer looking for a crash course on PHP? Here is an easy way. In the next 5 days I will be going through the entire PHP documentation and will be taking notes which are relevant and unique to PHP.

I am a hardcore Java programmer and hence by following me you can quickly learn PHP! My notes will be mainly based on the online PHP manual. Here is the first set of PHP notes.

General PHP Notes

1. PHP - PHP:Hypertext Preprocessor is an open source general purpose scripting language.

2. PHP can be used for server side scripting, command line processing and as a GUI application (PHP-GTK).

3. PHP is changed to a proper object oriented language from version 5 onwards and allows OOP paradigm.

4. First sample program, the famous “Hello World”,

<html>
<head><title>Hello World</title></head>
<body>
<?php echo “Hello World” ?>
</body>
</html>

5. PHP exposes a set of superglobal variables accessible from anywhere. For example, $_POST superglobal can be used to extract http post parameters. $_POST is an associative array.

6. If the HTML form field name contains a dot(.), it is converted to an underscore(_) automatically by PHP. For example, if the text field name is “user.name”, you should use $_POST["user_name"] to retrieve its value!

7. There are a couple of mailing lists available for PHP. It is at http://www.php.net/mailing-lists.php. So far I have only subscribed to “Announcements”.

Next set of PHP notes on the language features will be published tommorrow.

Starting PHP development

I have recently started on PHP programming (been postponing it for years!).  The official PHP manual seems to be the only source needed to learn PHP. It is pretty big and I think it will take a week for me to cover it.

An interesting feature of the online PHP manual is the inclusion of “User Contributed Notes”. Sometimes these notes are more informative than the manual entry :). But sometimes they can be misleading as well.

For testing out the scripts, I am using XAMPP Lite - An all in one Windows installer which contains  Apache 2.2.4 + PHP 5.2.1 + MySQL 5.0.33 + phpMyAdmin 2.9.2 + Openssl 0.9.8d + SQLite 2.8.15. Download, extract and run setup_xampp.bat and you have everything running in 5 minutes!

Also I am looking for a good PHP book which can be used as a single offline reference. PHP 5 Unleashed by John Coggeshall appears to be good, but I am yet to make a decision.