PHP Reflections

In my (rel­a­tive­ly) new job we use PHP for the back­end. This is the first time that I’ve used PHP for doing any real work and now that I’m using it for real I have found it to be an inter­est­ing lan­guage. I am still on the fence about whether I actu­al­ly like it or not but is does have some nice fea­tures. Given that I’ve only been using is seri­ous­ly for 3 months now I can’t claim to be an expert and I know that I’m just scratch­ing the sur­face at this point.

One of its best fea­tures is that dynam­i­cal­ly com­piled which real­ly short­ens the edit-​compile-​test cycle. I like being able to make small changes and see the (near­ly) imme­di­ate result with­out hav­ing to go through a build phase. It’s also nice that there is a large library of func­tion­al­i­ty avail­able as well as a large com­mu­ni­ty of third-​party solu­tions. I’m just now start­ing to look at some of the frame­works built on PHP and many look real­ly good. I do real­ly like the asso­cia­tive arrays, espe­cial­ly the abil­i­ty to eas­i­ly nest them, how­ev­er, I don’t like the way that PHP merges them with indexed arrays. I know that oth­er lan­guages do this as well, but I don’t like it.

I think my biggest prob­lem with PHP is just how easy it is to com­bine the out­put (view) with the log­ic (con­troller) and even mix in some data (mod­el) into one file. This is the same prob­lem that JSP had. This basi­cal­ly neces­si­tates a frame­work of some kind in any large project. The syn­tax is also prob­lem­at­ic for me. I find it messy and full of unnec­es­sary items like dol­lar signs ($) which I believe come from the Perl past. Perl had a rea­son for using a dol­lar sign for vari­ables: it indi­cates a “sim­ple” val­ue that is not an array (@) nor a hash (%). Given that PHP merges all of these into one pre­fix ($) it would be nice to get rid of it entirely.

Basically I think that PHP does a bet­ter job of fill­ing the “dynam­ic, script­ing lan­guage for gen­er­at­ing web pages” than JSP does, but I feel that it could be cleaned up a bit and a lit­tle more struc­ture added to make it eas­i­er to work with.

Leave a Reply