You are here: Re: What is the learning curve for PHP? « PHP Programming Language « IT news, forums, messages
Re: What is the learning curve for PHP?

Posted by Toby A Inkster on 03/30/07 09:30

K.J.Williams wrote:

> A friend and I want to learn PHP but we have two totally different
> programming backgrounds.
> I have experience with procedural programming in C, and he has
> experience with Visual BASIC.
> Well we wanted to know, what type of learning curve ( of difficulty )
> we would have trying to learn PHP?

PHP's syntax is fairly like C.

- Function calls are "function_name()"

- Lines end in semicolons

- Whitespace is mostly insignificant

- "if", "for", "while" and "switch" syntax is pretty much
the same

- Most of the mathematical, boolean, assignment and comparison
operators are the same

The biggest difference in syntax is that variables in PHP always begin
with a dollar sign, e.g. $foo.

However, PHP is a much higher level language than C. You rarely need to
worry about casting variables to a different type, and never have to deal
with pointers. Strings are a basic data type in PHP, and don't need to be
treated as an array of characters. Indeed, there isn't a character data
type -- characters are just strings with length 1.

PHP has a lot more functions built in to the language, compared to C where
a lot of functionality (e.g. database connectivity, regular expressions,
networking functions) needs to be imported through libraries.

PHP4 has a certain amount of OO support, and PHP 5 has almost as much OO
support as Java does; however, you don't have to use it!

> Also, What will be the most significant changes for us to adapt to? I
> wanted to know if PHP is like bash shell scripting for Linux?

Assuming that your previous programming experience is with GUI or
command-line programming in C/VB, then probably the biggest change you'll
need to make is not the new programming language that you'll need to
learn, but the paradigm shift of moving from desktop programming to web
programming.

With desktop programming, you're drawing objects to the local screen, and
you can draw these objects whenever you like really. With web programming,
your program has no direct access to the screen, keyboard or mouse of the
client machine. All you get told is that someone has requested page X with
query string Y and post data Z. Your program has a few seconds to figure
out what data it needs to send back, assemble that into some HTML and
output that. Then the data goes back to the client, whose machine renders
it to their screen using a mechanism that is beyond your control. Fun, eh?

Seriously, I think the desktop->web paradigm shift is a much bigger leap
than the change of programming language. I'd suggest at first writing a
CGI program, such as a small web forum, in a language you're familiar with
(e.g. C, or bash scripting) at first, and getting a feel for how web
programming as a whole works, and then make the shift to doing it with
PHP, which will then be comparatively easy.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация