Forum Moderators: coopster

Message Too Old, No Replies

Good source of example code

         

Bill_Noble

9:39 am on May 20, 2005 (gmt 0)



Does anyone know of a good source of example code that might be suitable to help a newbie get going with PHP?

grandpa

9:48 am on May 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi Bill_Noble, Welcome to WebmasterWorld.

Let's not recommend any of my code :) I got started with PHP by reading a book first. I spent 3 or 4 days digesting PHP 4 Bible (Converse & Park). After that it was just a matter of getting my feet wet.

The problem with looking at code is this: You are not only dealing with trying to understand the code itself, but the logic applied by the coder. Any one of us in this forum might approach the same problem with differing views about how to solve the problem. IMO, that's not an easy way to learn the basics.

jatar_k

4:07 pm on May 20, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld Bill_Noble,

this thread might help
Learning PHP - Books, Tutorials and Online Resources [webmasterworld.com]

there are a bunch of other tutorial type posts in the PHP Library [webmasterworld.com] as well

Sarah Atkinson

4:23 pm on May 20, 2005 (gmt 0)

10+ Year Member



I've been posting a lot on this calendar I am creating and it is simply amazing how many different ways people are suggesting to code it. It reminds me an old wonderful world of Disney show where a group of animators were ask to paint the same tree. They each set up their canvas or paper around the tree and went to work. Each piece was so different you wouldn't think it was the same tree(kinda like the blind men and the elephant story)

Anyway back to the point, just as you wouldn't learn how to paint by looking at those paintings you won't learn how to code by looking at someone elses code. You can admire the paintings and get ideas to use in your own work like color, brush strokes prespective. And you can do the same looking at someone elses code ("Oh wow, look how he did that for( ) statement. He saved 15 lines of code that way.")

As for getting started you realy need a teacher or a book(or both if you can swing it)

First you need to learn programing basics. logic and design what are functions, variables, scope, opperators expressions etc. (You may allready know this if you know other languages)I'm pretty sure most programing books cover this in the first chapter some probably better then others. After you have this down it makes the syntax of other languages easier to pick up... at least until you start puting statments like "int i=0;" in your php code.

Then start in with actual php. I suggest a book by Kevin Yank from sitepoint books. I have the O'Reilly programing php book which helps as a desk refference but it isn't great and I wouldn't buy it again... but I got it at 50% so..

I hope this helps .. I am kinda long winded.

Sarah

We should do challanges for simple scripting ideas and see just how many different ways people can attack the same problem. maybe even have special awards for shortest and longest code.

jatar_k

4:49 pm on May 20, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> I am kinda long winded

that wasn't even a very long post... but it is a very good one :)

Sarah Atkinson

5:12 pm on May 20, 2005 (gmt 0)

10+ Year Member



>>that wasn't even a very long post... but it is a very good one :)

Thank you jatar k.. you just made my day
Sarah

dreamcatcher

8:03 pm on May 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yep, great post Sarah Atkinson.

Another great way to learn is to read other people`s code. If you have a project you want to tackle, download some open source scripts and read the code to try and make sense of the logic. You can read it over and over in black and white, but sometimes an example of what you are trying to accomplish can make all the pieces fit into place.

The great thing about PHP is you`ll see things happening pretty much from the off and once you do, it will get to be a kind of addiction. Not a good thing if less computer time if what you are after. :)

If you have any problems, post here and we will try and help you out.

Good luck!

dc