A Love Poem in PHP

Posted by jeremyclarke on November 7, 2011 · General · WordPress

Wrote this a long time ago but never posted it. Stumbled onto it while cleaning up my email:

<?php
	$me = new Lover;

	$me->partner = $you;

	$me->feelings = array('adore','miss','want','love');

	foreach ($feelings as $feeling) {

		$me->express_feeling($feeling);

		if ($you->feeling_mutual($feeling))
			$me->epic_hugs($you);
	}
?>

Sure, it’s not the most expressive form of writing out there, but like with Haiku I think the limitation and challenge of putting poetry into code form can help push you to create something really fresh and strange without the baggage and cliché feel of regular poetry. I also just love naming variables and methods ;)

Either way, I think my poem is at least more uplifting than this other PHP love poem I found.

It was actually a follow-up to a shorter, twitter-length PHP love poem I wrote around the same time:

<?php
	$things_i_dont_miss_about_you = array();
?>

Submit your coded love poems in the comments, bonus points if it could at least theoretically execute in real life (assuming for example things like the existence of a “Lover” class with an express_feeling() method). If you’ve got the time write us an Epic PHP Poem, including all the needed class definitions :P

Posted by jeremyclarke on · General · WordPress

3 Comments

  1. Jim

    Are PHP love poems more lasting than JavaScript poems?

    November 7th, 2011 at 7:32 pm

  2. mira

    aw, that twitter poem is the sweetest thing. the longer one is nice, too. :)

    February 7th, 2012 at 6:53 pm

  3. billythekid

    people->you))$myLife->quality++;
    ?>

    careful of the appearance of infinite loop memory hogging on long term relationships…

    April 8th, 2012 at 7:22 am

Add new comment (email only seen by Jeremy)