News for hackers. Stuff that matters.
Re:Ask HN: What's the coolest PHP snippet you know? by ecaron on Friday July 29, 2011 @12:01AM (#2820111)
I have been playing with that, the problem is that everything is really just cool within its context. We also try to follow the logic that good code must be easy to understand, not the kind of magic code that works great but can't be debugged. Put that code on the wall and it is, well, boring.

The sample I started with is kind of a magic-method interpretation of how our system works:

  <?php
  $jobs = array();
  foreach (Companies::getAll AS $company) {
    array_push($jobs, $company->getJobs();
  }
  $results = Search::fromKeyword($jobs);
  foreach ($results AS $result) {
    $result->displayJob();
  }

There are no comments on this comment yet.