I am currently in the process of learning PHP, I'm following along with a book(PHP 6 and MySQL 5 for Dynamic Web Sites by Larry Ullman) but in my past experiences with learning new programming languages I have often found myself best served by writing small programs in addition to following along with a text.

So, what I'm looking for is some simple things I could write in PHP to help me get more familiar. Anyone know of a site that could provide me the resources I'm looking for? Or even any ideas of some stuff I could/should code?

I did the online PHP/MySQL course at Ed2Go a couple years ago. The project was a sort of wiki for recipes.posted by neuron at 4:01 PM on June 30, 2009

I spent the weekend programming forms for a high school reunion website. That was a pretty good trial by fire! It involved learning how to work with databases and enhance PHP with bits of Javascript. Forms are such a basic thing, but there are so many different ways to approach them and they are incredibly useful when they work well. Maybe you could add that to your list of things to try?posted by bristolcat at 5:59 PM on June 30, 2009

90% of the work you'll generally do when web programming is this: you take a slab of data and you 1) list it, like in a table and 2) you allow the end-user to add, edit, update and delete that data. (Known affectionately as CRUD.) Succeed at building this and you will be off to the races in good form.

Do you collect anything? DVDs? Video games? Star Wars Action figures? Use that as a starting point. Create an empty database table. Use a basic MySQL tool like PHPMyAdmin to create a basic schema and insert some starting data, like 5 rows. See if you can list that data in a table.

If that works, make it so that you can click and edit an entry. It should take the user to a form, pre-populate it with existing data and allow the user to make changes and submit.

If that works, make it so that you can add an entry. If that works, make it so that you can delete an entry.

Inside of that simple concept are a million little details. For instance, do you re-use the same form on add/edit or do you duplicate it. And if you duplicate it, how do you keep them in sync as you add more fields to the table? How do you validate form entries? And so on. So a basic project like this would give you a good starting point.posted by bprater at 7:09 PM on June 30, 2009 [1 favorite]

I learn exactly the same way you do: with a solid reference at hand, but mostly by coding and seeing those functions associate themselves with possible uses, thereby coming to life in front of my eyes.

Think of something you would would find neat to create, but relatively simple and straightforward, like a countdown to someone's birthday. Break it down into tasks: put their birthday in a variable, generate today's date, subtract and output. Simple psuedocode, but each step requires you to look up exactly how something is done.

Google will be your best friend through this learning experience, and you will often find the PHP manual pages to be at the top of your results. Along the way you'll learn how to assign variables, how to print to the screen, how and when to use date() and time() functions, and even get an idea about how casting works. All from a simple birthday timer.

Expand from there. Maybe you want to let the user enter a date themselves, which lets you learn about forms and formatting. Connect your page with a basic MySQL installation (look up WAMP on Windows, MAMP on Mac and LAMP on Linux) to log what birthdays have been calculated in the past, and then find ways to manipulate it.

Or even go into a totally separate direction, say with a palindrome checker. That would let you get some experience with string manipulation, if statements, and while/for loops. Later on you could write any valid palindromes to your database, and then let the user view palindromes that start with any particular letter.

Start small, almost stupidly small, and then expand. "Okay, I've done this, where else can I go? How can I accomplish that?" Once you've got a basic handling of the language, its data structures and flow, go all out with a full-fledged project, like the ones bprater and AmbroseChapel suggested above. They'll probably be rough, bland copies of software that has already existed for years, but the real goal is the knowledge and experience you'll pick up along the way.posted by ThatRandomGuy at 9:17 AM on July 1, 2009 [1 favorite]

« Older But it is your favorite ball of string! | How do I override "Override All Compatibility" in... Newer »

Tags

Share

About Ask MetaFilter

Ask MetaFilter is a question and answer site that covers nearly any question on earth, where members help each other solve problems. Ask MetaFilter is where thousands of life's little questions are answered.