Welcome to WebmasterWorld Guest from 188.8.131.52
People often find it easier to learn by example; I suggest you look in this forum's library to soak up some short, relatively simple examples - doesn't really matter which topic. Don't get too hung up on methodology - if you give 5 programmers a task of any complexity you will likely get back 5 different ways of doing it. Copy & paste the scripts to fiddle with, mangle, and build on them. The PHP Bag of Tricks [webmasterworld.com] series has a lot of good stuff.
You could also hit some of the script repositories, although those will be longer and more complex.
Stick with it - it will begin to make sense sooner or later.
One thing that helps is a good text editor that highlights and color-codes your code.
There are also plenty of tutorials online, one can be found on W3Schools: [w3schools.com...]
However i wouldn't recommend using an "All in One" package to install php+apache+mysql. Although it sounds easier for a beginer but you know you ll always be asking ok how was this done how was that done ? i would recommend getting all those 3 packages seperately and install them one by one on your computer and then you can think learning php.
It probably takes you hours to install but trust me you ll learn allot of the stuff even before you start coding, i do so with every person who asks me to teach them php. I can write you a procedure for all the installations if you are interested in this idea.
[edited by: Anyango at 9:30 am (utc) on Oct. 16, 2008]
Learn HTML and CSS first, make a simple page in word, tables, backgrounds, hyperlinks, bold, italics and an image. Then do that page in HTML the same as your word document.
Then try doing it with some php, do a form, post the form to yourself and play with the $_POST['names'] you send.
Then try connecting to a DB - try using Zebra PHP database wrapper. Sorry for posting a name but it is really simple and really good to learn on.
It's hard, it isn't easy. Start with simple stuff then build on that. IN 6 months time you will be a wiz!
I have no programing experience
I don't wish to start a fight, but with all due respect to your opinion, someone who has never programmed before cannot learn to program in two days. I did "learn php in a day" five years ago using the O'Reilly Pocket Reference but that's on top of over a dozen other languages including C++ and over 25 years' (then) programming experience. Since joining Webmaster World I have at least doubled my PHP expertise by reading the posts by the four fellows listed up there just above PHP Server Side Scripting, several good techniques in this forum's library, and certainly not least, some regex from php_chimp (and make no mistake about it, no PHP education is complete without screaming in terror over a few regular expressions), so I'm pretty sure I'm not quite finished learning all of PHP's ins & outs yet.
I understand that your assertion is 'just the basics', but someone who sees for($x = 10;$x;$x--) for the first time has to be told what that means and isn't particularly likely to remember it tomorrow after also being told everything you need to know about variables, native types, arrays both numeric and associative, multidimensional arrays, variable variables, operator precedence, string concatenation, statement groups, functions, variable functions, variable arguments...
Someone who has never programmed before spends day 1 learning what a statement is and what a variable is. If the student didn't have algebra in school then days 2-5 are also spent on what a variable is, otherwise it's on to operators and why $x = $x + 1 makes sense to a computer when any mathemetician will tell you it's impossible.
If you know a programming language, then yes, you can ramp up pretty quickly, if you know C then you can ramp up even more quickly, but cowan5 and any other person who has never programmed before has a whole lot to learn with brand new concepts that are completely alien to any other situation in the real world. Any frustration or feelings of hopelessness are real, deserved, expected, and will not go away in 24 hours.
I think it aint that complex, PHP
The syntax isn't too difficult to understand, especially if you have past programming experience, and of course the program logic is the same, however, for someone with no programming background it can be overwhelming. There are also other factors involved in learning PHP that are beyond the scope of syntax. There are millions of PHP developers out there that "know" how to program PHP, but little that know how to do it correctly. There's security that always must be made aware of which the amount of information in itself is large and CAN be complex, for example. To say that PHP can be learned in 2 days is something that I know is impossible. You may be able to understand basic syntax and structure, but that's about it. I've spent years dealing with PHP and I don't know anything relative to what's out there.
Many introductory programming classes, at a tech school for example, start off with something like Matlab to teach the fundamentals of programming structure and logic to non-CS majors, otherwise they use Java; the focus isn't on the intricacies as much as with other languages, with Matlab, however. That is if you want to take this approach. There are plenty of online resources available for PHP and you should always just try making little examples and working off of them. Ask questions in this forum ALL THE TIME and you will be well on your way to learning tons of information that you would have thought you'd never learn in your class. Pick apart code, always ask WHY, and look up as much as possible at [php.net...] and you'll be fine. It's not something that is going to happen overnight, especially if you are unfamiliar with programming as of right now.
I have a desire to script in PHP. I find myself looking continuously at my prompt sheets and not remembering my little c++ experiences and now I wished I learnt more. Even as a competent programmer I find it difficult to remember the PHP way of life, starting from scratch with PHP I think may have advantages as to hone the language without bad habits from other languages but it will definitely take longer than a couple of days, well maybe a couple of days to get a "Hello world" output.
You can also watch the lectures [groups.csail.mit.edu] from 1985. That may seem like a long time ago, but the underlying concepts haven't changed.
SICP was written before PHP even existed, but first learning basic programming concepts will help you immensely in learning a programming language--regardless of what that language happens to be.
Another book which comes to mind is How to Design Programs [htdp.org] (HtDP). Sadly, it's still sitting in my "Things to Read" list, so I can't tell you how good it is. :)