Preface:
I have spent a couple of years writing primarily Ruby code. Recently, I began a new project which requires dynamic web functionality. And if there’s one thing I’ve learned about programming, is the importance of picking the right tool for the job. For example, I run Apache, so PHP is the logical choice for a dynamic language. (I.e., Dealing with mongrel sucks!)
Thoughts after spending 20 minutes coding PHP:
- Coding PHP feels like playing with a very small, very old toy.
- I’m not sure why, but I never used to write PHP functions like the following in the days before I started learning Ruby. Could it be that learning Ruby has improved my general programming abilities; i.e., my ability to write non-Ruby code? That would seem counter-intuitive to me. I have always thought that to be good at writing any particular language just takes a lot of practice, and I haven’t touched PHP in at least two years… It definitely feels strange that when I code in PHP now, I am not only able to more quickly parse PHP’s syntax, but I can also understand program semantics more rapidly. This has got me thinking I should step outside the Ruby box more often . . .
function process()
{
return join(SPACE,
array(
// the parties
join(
join(" v. ",
array($_GET["pi"],
$_GET["delta"])),
array("<em>",
"</em>,")),
// the paperbound info
join(SPACE,
array($_GET['volume'],
$_GET['reporter'])),
// the page number info
($_GET['next_pp'] == "") ?
($_GET['init_pp'] .= SPACE) :
join(', ',
array($_GET['init_pp'],
$_GET['next_pp'])),
// the court and year
join(
join(SPACE,
array($_GET['court'],
$_GET['year'])),
array('(',')'))));
}