Sunday, April 24, 2011

Lesson 1: Coding styles

When you start with PHP it is important to understand that your code must not only be correct from computers point of view, but it also should be readable for other programmers, to make it easier some good people worked out some rules, which you should follow when you write your code.
There exists few styles of placement of braces( {} ) and they are dictated by C-like languages of programming.
1)Rational style
One of the most used styles cuz it was used by creators of C Kernighan and Ritchie.
It is also used by Java programmers a lot.
+ It saves vertical space, which may be very important especially when your code is big.
- Sometimes it is hard to locate } somewhere in the end of a row...
2)Allman's style
Eric Allman is the man who wrote BSD utilities in that style, so this style is sometimes called "BSD style".
+ The area of block operator is easily visually associated with controlling operator.
3)Whitesmith style
+brackets are more easily associated with code.
4) GNU style
This style was introduced to me in Simple PHP ebook and i am using this style even today.
It was developed by Free Software Foundation fond.
Within controlling constructions operators should be placed with equal number of spaces.
Note:indetation must be wether 2, 4 or 8 spaces.

Sunday, April 17, 2011

Lesson 0: Why PHP?

It’s the Lesson 0, because we will not make any script here. Actual learning will start in the first lesson, but now I’ll tell a little bit about PHP and will try to explain why it is the best solution for your web-site.

Why PHP?

Kinda good question…

* It’s easy to learn. PHP is the easiest and the most flexible language for Internet programming. It’s never mind if you didn’t program before. I will teach you how to make your own PHP scripts with zero skill.

* No special software required. You need only one software to begin with PHP it’s Windows Notepad or any other text editor.

* PHP is the most powerful Internet language. Even the well known Java or JavaScript can’t offer you all these things, that offers PHP.

* PHP is the most common online programming language. Statistics shows, that 60% of Internet web-sites are based on PHP technology or they are related with PHP scripts... P for PHP baby ;)

So… What did you pick? I don’t care… Because the story will be about PHP… If you want to learn Java then visit Google.com for Java Lessons :) Anyway PHP is much easier, so i recommend you to start with it! I discovered PHP for myself when my friend told me about Simple PHP ebook. After two days of reading I was ready to make my own script. It wasn't the script, that is showing you simple line in your browser. It was small photo gallery, for tiny emoticons for instant messengers or forums. Demo of this script in my next lessons.

Next lesson will be about.. Mmm.. Let me surprise you ;) It will be published next week, so stay with us and don't forget to subscribe to our RSS ;)