How long did it take you to learn php?

I’m relatively new to php, and am trying to learn. How long did it take you from the point of 0 php knowledge to a level of competence where you could actually construct your own, functional website?

Peronsally, I dont think it matters how long it takes others.

There are a few other factors involved. How comfortable you are with programming, how much time you dedicate to it every day/week/month, practice, do you have any programming experience? Those normally help.

Furthermore, by “building a funcitonal website”, do you mean database oriented website or a website with a bunch of includes and a contact form?

Learning is an ongoing process, but as far as constructing a functional website on your own is concerned, it goes quite fast with php.

I guess I was referring more to database driven sites.

Hmmm…that’s almost like asking ‘How long is a piece of string?’

The only way to answer that is with an example I guess. I built my first functioning database driven website after about a month of working with PHP, I spent about 2 hours a day on it. Now it was functioning, and live and I must say had a lot of traffic after about a year. Looking back at it however, it wasn’t very secure or efficient and the code was a mess.

Learning enough PHP to build an app can be fairly quick, but like anything it depends on how much time you spend working at it. I’ve been working with PHP for over 5 years now and I’m still learning things all the time.

I’ve been doing it for about 5 years now, and I’m still learning.

Becoming strong in it doesn’t take long at all though. It’s just practice and learning how to write “optimal” code (like functions, classes, etc).

Building a database driven site virtually consists of knowing how to use less than 10 things:

[][fphp]mysql_query[/fphp] (and [fphp]mysql_connect[/fphp]/[fphp]mysql_select_db[/fphp]).
]Basic Syntax
]Funtions (heck, that’s not even required, but it’s definitely something you’re going to want to know).
[/list]Basically just read the Language Reference section and the [url=“”]MySQL Reference page and you’re good to go.

Oh, and you need to learn SQL at some point, but you can get off with the basics:

[]Knowing how to use phpMyAdmin (relatively straight forward)
]SELECT fields FROM table WHERE field=‘value’;
[]UPDATE table SET field=‘newvalue’;
]INSERT table VALUES(‘field1’, ‘field2’)
[*]DELETE FROM table WHERE field=‘value’;
[/list]Literally, all of the tutorials out there are way too complicated for beginners. Reading books for learning PHP has always seemed redundant to me, considering how basic the syntax is (just to clarify, I mean for learning the basics of PHP – obviously learning OO techniques or proper database design you could use books, but that basics are pretty… basic).

Once you understand everything from the above links, it’ll be a lot easier to follow tutorials, or follow books (ie. PHP Anthology).

For me, I read a few tutorials on MySQL (sample chapters of Kevin Yank’s book, as well as something from Harry Feucks’ old site), and I was writing a basic database program (basic as in adding/editing/deleting/viewing) within an hour or two.

From there, you should try and write a larger app (I chose to write a bulletin board as my first app, started the same day that I “learned” PHP). If you have a large app to work towards, you’ll be able to learn as you go. Writing a large application is nothing more than a bunch of small little applications, so try not to get intimidated.

The best part about writing a larger app is that you’ll discover new functions. For example, one day I needed to show just the first 200 characters of the description and so I posted here at SP. Virtually instantly I was given the response to use “echo substr($a, 0, 200); if (strlen($a) > 200) echo ‘…’;”. That’s how I learned what substr and strlen were. As soon as I found out about the function, I went to and and read the manual page.

As with everyone, you’ll always keep coming across new functions all the time. The key is that when you ask for PHP help at SP (or any other forum), you MUST learn what the given function does. The single worst thing you can do is to take the code they give and just implement it. There are TONS of people here at SP who ask virtually the same question dozens of times because they never actually learn – it’s very frusturating to watch.

Over time, your internal library of PHP function knowledge will grow to the point that you can do almost anything without referencing the manual. And hey, there’s no shame in going back to the manual now and then – the other day I went to the manual for the function [fphp]in_array[/fphp] because I wasn’t sure which was the needle parameter (which you’ll notice is a huge issue with PHP – things tend to jump back and fourth).

Of course, that’s just my philosophy. I’m sure a lot of other people will tell you to read a bunch of books and stuff, but it’ll ultimately be your decision what route you take.

:agree: That’s pretty much the only reason I go to the manual nowadays.

I’ve been at it for about 3/4 of a year (on and off, sometimes I get into video game playing phases, sometimes programming only) and I feel I’ve learned quite a bit. I understand the idea of programming and I am able to apply my knowledge from PHP to other languages, which is what is ideal when learning a language. I am able to make database driven projects and I can work with flat files, I can do encryption/decryption, toying with cookies and sessions, and other useful functions. I know how OOP works and can do some of it, just not the advanced stuff (such as extends, maybe it’s easy but I just don’t know how or what it does). I was able to pick up what I know in C++ very quickly because of my PHP background, and I feel this means I have learned what I need to know in PHP (though I continue to learn it until I move on to ASP next year).

I would highly recommend PHP for dummies. It is the simplest book I have been able to find. I read it in about a month, and was able to make a website with some PHP functions right after (with help of the book).

The main thing to remember is not to give up if you have trouble. If there is something you can’t figure out, post here and we are all glad to help out.

Also DO NOT learn by viewing other people’s code. Most coders (including myself) develop bad habits with experience. Make sure you learn from a professionally written book.

Excellent post Nathan, this certainly applies with me. I started looking into PHP about 1 year or so ago with no programming background. I learnt it as I needed to, i.e. there are some functions in PHP that I have not used yet so I have not read about them yet. But when that project comes along, I’ll know where to find out how to do it.


1 Like

Took me about 4 months (still learning) I wrote a couple sites myself already but i spent about 10-15 hours a day looking at scripts and reading e-books and looking at but its paying off now

You must keep in mind that all of our minds are different. I have no problem retaining information and utilizing it from just seeing it once, perhaps a year later. Just a gift I have.

Others are different. You may be able to get a great grasp on it within a month. If you have experience in other languages – you are at a definite advantage. I know people who get stuck on relatively simple concepts (arrays, loops, etc) and it takes a month for them to get it straight in their head.

You never know until you try it out. Keep in mind though, practice makes perfect.

If you are asking with respect to: you told someone you would build them a website and you have never done it before – count on it taking quite a bit longer to learn – anyone can learn anything – but there are right and wrong ways of coding. Practice gets you to the right side.

Oh and as previously mentioned by others, you never stop learning a language whether spoken or coded! That is why I love languages so much!

(TIP: books are great but dissecting is better. Find a script archive ( is great) and get scripts that look interesting. Dissect them. Break them into lines and based on Google research and looking up stuff on figure out what each line does. If you start that way you will get a much better grasp than just starting with “Hello World!” While the syntax is very important - having a knowledge of the flow is more important - once you understand how it works - learn the code that makes it work!)

1 Like

FWIW, there are a lot of php books you can download for free.

I knew a little of HTML, ASP and javascript already… but in less than 2 weeks(about 2 hours a day) I had a website up and running with a database consisting of 3 tables. But to become really good, you will probably learn all your life.

It took me 3-6 months to feel that I could start calling myself a web programmer. Though I still havent stopped learning. Each new project brings a new challenge that teaches me new things.

I have been programming in PHP for around 2 years and am still learning, so I cant really say. Although I felt that after 6 months of solid work learning PHP I could make a pretty simple script.

Learning PHP, ASP, C++, Javascript or any object oriented language is fun, and the more hours you put into it, the better.

I myself pretty much learned the basic of ASP within 3 months with the help of various books and tips found on ASP ressources websites.

Now the difficult part from my standpoint is building the database to connect to your PHP, or ASP applications.

At first I thought, OK, so I’ll enter all the data from the items in the database, not that simple, cause when you go back to your coding and SQL statements, you realize the way you design your database, specifically how all the elements are related and connected to each other does affect the performance of your website.

So enjoy learning PHP, give yourself a few months, that’s the fun part, next you’ll have to kill your brains into designing the architecture of your database. But the rewards are immense, cause databases are quite powerful, especially if you put everything in it.

Still learning :slight_smile:

And I think you have to look beyond PHP if you really want to master web development with PHP, because there are lots of good ideas out there which we can bring to our PHP development.

1 hour, 22 minutes.