Need ideas for a really cool (and challenging) beginner's program I can write in PHP.
November 6, 2009 3:01 PM   Subscribe

Need ideas for a really cool and challenging beginner's program I can write in PHP.

For the final assignment of my beginner's programming class (the language is PHP), I get to write a program that will do whatever I like. I'm really dorkishly excited and I want to choose something both cool and kinda tough - something I'll learn a lot from putting together.

The program has to contain decision structures, looping and arrays at the very least. I can involve other scripts / languages or web stuff if I choose, but as it stands right now, I don't know how to run web apps - only a little bit of HTML and CSS. And there won't be any GUI, since we haven't learned any of that in conjunction with PHP. My instructor has suggested a financial calculator or a contact manager. These seem booooring. And a little bit too easy, too. Yes, I'm a beginner, but I think I can handle something more than that.

Please help me come up with some ideas. What was the coolest 'first real program' you wrote?
posted by kitcat to Technology (15 answers total) 7 users marked this as a favorite
 
A blogging engine? You could write a script that lets you write, read, edit and tag posts.
posted by invitapriore at 3:22 PM on November 6, 2009


I've always been fascinated by calendar- and ephemeris-calculating apps. Many of the formulas and algorithms are already out there.

Create a page where you plug in your location (lat/long) and get a full almanac for the day.
posted by jquinby at 3:48 PM on November 6, 2009


Also, the first real program I ever wrote was (arguably) a little perl script to decrypt the old Cisco hashed passwords, based on something I read (in phrack, IIRC) quite a few years ago. That was fun, but maybe not so useful nowadays. You could pare down my prior suggestion to simply (!) calculating the date for Easter, given any particular year.
posted by jquinby at 3:55 PM on November 6, 2009


Convert roman numerals to our arabic numerals and vice versa.

It's quite a nice little exercise for a beginner, and perhaps not as simple as it first may appear.
posted by BigCalm at 4:11 PM on November 6, 2009


This isn't the coolest 'first real program' I wrote (the first real program I wrote was an edusoft maths game for my school kindergarten but that was in VB) its the program that I wish I had time to write but since I do this professionally, clients come first :(

Basically its a system for editing static web page content.

The user enters their ftp details then and your script connects to their website and lists the directory contents (so you've got looping and recursion covered there). The user selects the file to edit then based on the filetype you present an edit page (decisions). In the case of images/pdfs etc you'd just have an upload box and you'd replace the file with the new content, assuming the filetypes matched. If the file was an html file you parse the content and split it up into editable chunks eg. headers, paragraphs, images etc then when they press save you reassemble all those bits back into a page and save it. You're bound to need arrays somewhere in all that, you always need arrays.

Its just a bit of fun but it could form the basis of something really cool and I know its been done a couple of times before but that doesn't mean it isn't fun figuring out how its all done :D (yeah, yeah, I'm a nerd, I know)

Or you could do some sort of game. Have you learnt databases yet? If not you're kind of limited in what you can do. You could do a grid based adventure - ie. move your character around a grid - oh no! random encounter... fight... woot! ding... level up - etc.
posted by missmagenta at 4:12 PM on November 6, 2009


My method of getting stuck into a new language has always been to write (or adapt) a version of the old text-based Trek game. Various dialects of BASIC, Z80 / CP/M & 8086 / Dos assembly, Javascript, Java, PHP, C, ObjC so far&hellip

(Though next year's project looks like I'll have to become adept in R. I dunno if that'll work so well…)
posted by Pinback at 5:07 PM on November 6, 2009


Response by poster: SQL is part of my current 'toolkit' too. I've used VB.NET with it, but not PHP.
posted by kitcat at 5:40 PM on November 6, 2009


My first project was a guestbook with flatfiles, if you don't want to do a DB you could start with that, or you could use mysql if you're up for it

A step up would be guestbook+comments, and then a message board.

A basic CMS is a good idea too, having the ability to write an article and post it to a specific page.
posted by Sonic_Molson at 5:48 PM on November 6, 2009


Something else that might be interesting and fun would be a Markov generator (more info here, though you needn't deal with the tangle of equations lower on the page to implement it, don't worry). It'd take some thought as to how to implement, but the end-product is a lot of fun to play with. I've made one of these before, so if it's something you're interested in and you'd like some pointers, feel free to memail me.
posted by invitapriore at 6:08 PM on November 6, 2009


Nthing basic CMS - even though it's a problem that's been solved many times over in PHP and other languages, getting a grasp of the basic patterns and logic behind editing, organizing, and displaying content will serve you very well in the future if you need to work with an existing project.

Image manipulation is fun, too - assuming you have the GD library at your disposal there are a lot of possibilities there; take a directory of image files, scale them and make an HTML thumbnail gallery, etc.
posted by usonian at 6:13 PM on November 6, 2009


I'm confused with your mention of non-GUI. Is this a command line only project or is it running in the browser? Do you know how to do key-based arrays? How about a basic Tic Tac To game? Connect four? Any game with an algorithm that you can draw on paper would work great. How about a card game? Keep hacking man, I've been doing it all my life and love it to this day. I'd love to be cooking up a PHP based game if I weren't so busy on my own projects!
posted by bprater at 7:34 PM on November 6, 2009


Response by poster: Yes, everything we've done so far has been in the command line. This doesn't mean I can't do it in a browser - I'd just have to do some research on how.
posted by kitcat at 8:36 PM on November 6, 2009


MAMP (Mac) and WAMP (Windows) make quite easy to get an Apache/MySQL/PHP stack up and running on your computer. Most Linux installs either come with the AMP stack already installed, or readily available as packages. Get it running, save a PHP file in the apache directory, and off you go.
posted by usonian at 8:54 PM on November 6, 2009


Build a simple web crawler that looks through Wikipedia pages. On each page, collect a list of other Wikipedia articles that it links to. I had mine look through the top few most linked to articles on each page. Crawl down a few levels and then output a graphviz file. Have your php script run graphviz, creating a nice visual graph of related Wikipedia pages. You can include command line parameters for starting page, breadth, and depth of search. You will probably have to learn some stuff about regular expressions for this to work.

Another idea based on a program I wrote is to make an chat bot. There is a PHP class out there called BlueTOC that will get you connected to AIM and running callback functions when messages are received.
posted by katerschluck at 10:13 PM on November 6, 2009


A simple database app would be my suggestion. When I wanted to re-learn PHP and MySQL recently, I wrote a little app that implements flickr-like tagging, i.e. a many-to-many relationship between entities (basically filenames) and tags. You need some way of adding and removing tags from entities, listing tags on an entity and searching for lists of entities using union, intersection and difference operations on tags. Not to mention database-cleanliness stuff like cleaning out orphan tags and entities.

If that's too hard, what about a gallery application? Requires you to run it in a browser, but that's not hard if you can install Apache. Once you have Apache and PHP integrated and happy, it's just a matter of printing valid XHTML to stdout in your PHP scripts.
posted by polyglot at 4:45 AM on November 7, 2009


« Older Where can I find leak-proof ok-to-travel-size...   |   green vs brown field - jargon decoder? Newer »
This thread is closed to new comments.