Re: What is the learning curve for PHP?



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!
.



Relevant Pages

  • Re: Websites 101
    ... Some things have changed in PHP already thoug. ... but people who understand very little about programming ... The more similar a language is to an other, ... PHP borrows a lot from Perl, ...
    (alt.internet.search-engines)
  • Re: Any PHP Anti-Spam cron scripts available?
    ... is between language lawyers, and has little to do with actual ... programming, and I've published on programming topics since my article ... lawyers" who wish to exclude uses of the PHP language. ...
    (comp.lang.php)
  • Re: Which is easier to learn CGI or PHP?
    ... >>was wondering which is easier to learn php or cgi. ... Same holds for PHP. ... That holds for any programming language. ...
    (comp.lang.php)
  • Re: Is PHP the right language for this application (described below)? If not, any suggestions?
    ... which language should this application be written in (PHP, SQL, JS, ... PHP will work fine, so will Java, Perl and several other languages. ... Impossible to give a price without a lot more details. ... I don't even give a fixed price for programming until the screen designs are completed, data requirements nailed down, program flow defined... ...
    (comp.lang.php)
  • Re: What can Ruby do that PHP can not?
    ... and it really answered the fundamental question I posed -- What can Ruby do that PHP can not? ... Just a general point about selecting the language. ... regards trookat. ... Personally I feel every person that wants to learn programming should learn C then learn to code the ASM equiv so they can grasp what is going on when they write something. ...
    (comp.lang.php)