Build a Buzzword Bingo Card in PHP

In the past, I’ve done a fair bit of work with government departments. Here are three things I learned from that experience:

  1. government workers love meetings
  2. government workers also love jargon
  3. when you combine meetings and jargon, you have excellent conditions for a quick game of Buzzword Bingo*

If you’ve yet to play Buzzword Bingo, you’re missing out on great fun! It’s a game in which you collect buzzwords, clichés, and weasel words, then arrange them in a grid and check them off as you hear them during a particularly wordy meeting. When you’ve checked off a row, column, or diagonal line — bingo!

With just a little bit of beginner PHP and a good collection of jargon words, you can make your own buzzword bingo card that’s randomly generated every time you load the page. Let’s take a look.

(*Buzzword Bingo has a less than worksafe name too, but because we want this newsletter to pass by unimpeded by any cursing filters, I can’t repeat it here.)

Step 1: Create a Function Shell

We’ll be creating a function called Bingo to generate a random buzzword bingo card, which we can then include within a document. Let’s start out by creating a document shell with the Bingo function inside (I’ve called mine bingo.php):

<?php
  function Bingo() {

  }
?>

Step 2: Compile Some Buzzwords

Grab a list of the jargon words or phrases you’d like to see in your bingo cards. You’ll need at least 25 to fill a bingo card, so be sure you have a good collection. I’ve just spent an amusing few minutes strolling around Weasel Words, a site devoted to collecting some horrible examples of managerial speak, and I’ve plucked a bagful of my favorites.

Let’s pop these in an array inside our PHP function:

$buzzwords = array(
  "leverage",
  "synergy",
  "stakeholder",
  "touch-points",
  "knowledge initiatives",
  "cross-organizational collaboration",
  "strategic planning",
  "dynamics",
  "catalyst",
  "values-driven",
  "evangelize",
  "incentivize",
  "loop back",
  "let's take this offline",
  "360 degree thinking",
  "in the pipeline",
  "actioning",
  "paradigm",
  "2.0",
  "going forward",
  "game plan",
  "the end of the day",
  "thought leading",
  "on board",
  "monetize"
  );

Step 3: Do the Shuffle

We want to make sure our card has a random arrangement of buzzwords, so we’ll use PHP’s shuffle function to jumble up the items in the array:

shuffle($buzzwords);

Step 4: Prepare a Table

Bingo is all about filling up rows or columns in a grid, so we’ll use a table to arrange the items.

Let’s create a new variable called $bingocard and start preparing the table markup. You can see I’ve left a gap in the middle — this is where we’ll later put the code that creates the cells and rows.

$bingocard = "<table id='bingo'
summary='A random selection of 25 buzzwords
arranged in a bingo card'>";
$bingocard .= "<thead><tr>";
$bingocard .= "<th>B</th>
      <th>I</th><th>N</th>
      <th>G</th><th>O</th>";
$bingocard .= "</tr></thead>";
$bingocard .= "<tbody>";
$bingocard .= "<tr>";

// here's the gap 

$bingocard .= "</tr>";
$bingocard .= "</tbody>";
$bingocard .= "</table>";

Step 5: Create Cells and Rows

We now need to create 25 cells from the items in our buzzwords array. We’ll use a for loop to iterate through the items in our shuffled array 25 times, and create a table cell for each. That for loop goes in the gap we left in the previous step.

Our table will be a 5×5 grid, so we’ll also need to create five rows, each with five cells. We already prepared the start of our first row and the end of our last row, so we’ll also need to double-check to make sure we don’t do this on the last cell.

To work that out, I’ve used a variable $rowend, which is the remainder of $cell + 1, divided by five. After we create each cell, there’s a small if statement to check whether a $rowend is zero, and that it isn’t the 25th cell. If that’s the case, we’ll close and open a table row element.

Here’s the for loop:

for($cell=0; $cell<25; $cell++)
  {
    $rowend = ($cell + 1) % 5;
    $bingocard .= "<td>" 
     . $buzzwords[$cell] . "</td>";
    if($rowend == 0 && $cell < 24) {
      $bingocard .= "</tr>n<tr>";
    }
  }

Step 6: Echo the Table

We’ve built an array, shuffled it, and made it into a table. All that’s left to do now is print it:

echo $bingocard;

… and we’re nearly done! You should now have a PHP file that looks similar to Example 1.

Step 7: Drop It in A Document

Let’s now use this function in a web page. Include the bingo.php file at the start of the document:

<?php include ('/path/to/bingo.php'); ?>

Now call on the Bingo function wherever you need to put your card:

<?php Bingo(); ?>

Use some CSS to style the buzzword bingo table how you’d like. You can see a very plain example of a bingo card in Example 2, and the results in Example 3. You might even like to layer on some JavaScript to let players check off each cell by clicking on it, or cause an amusing effect when the player achieves bingo.

Step 8: Play!

When you’re happy with how your card looks, it’s time to pass on the URL of the bingo card to your co-workers. Next time there’s a meeting, print a copy for every player, and see who can call bingo first!

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • http://www.torkiljohnsen.com/cv torkil

    I thought this was called Bullshit Bingo? :)

  • http://www.heyraena.com raena

    @torkil, I’m not sure how secure my employment would be if I posted BS Bingo all over our home page. ;)

  • khuramyz

    Isnt it the bullshit generator?

  • http://www.rexibit.com/ Rexibit

    This would be a funny thing to have mixed in with a few of your group’s agenda sheets and see who is the first one to snicker and mouth “BINGO.”

  • http://fcOnTheWeb.com ferrari_chris

    Personally, I’ve never liked having a function write out HTML for you, as you have when the function has echo and you simply call Bingo();.

    I prefer to have the function return an HTML string and then use: echo Bingo();.

    But like I said, that’s just a personal thing…

  • Anonymous

    Great tool for increasing meeting participation

  • Stressed American

    Sounds like government workers need to have a few more layoffs and pay cuts, like those of us that pay their way..

  • Pioneering

    @khuramyz I believe you’re thinking of the Chomskybot.

  • ScubaDvr2

    You forgot one thing.

    Right under this:
    shuffle($buzzwords);

    Add this:
    $buzzwords[12] = 'FREE';

  • http://www.heyraena.com raena

    You know, it hardly ever occurs to me to think about how it’s done in the US (we don’t do the free cell here in Australia with bingo).

    Easily added though, just like that :)

  • Bob Carologees

    can we add “pointless” and “annoying” to the array

  • imaginethis

    What’s the point now? I think I missed it some where…

  • John

    The point, is that it’s a game as previously explained. And a good one considering.

  • http://www.suburban-glory.com/ Divisive Cotton

    Excellent :)

  • DuleyNoted

    Am I missing something? I used the Example 1 and Example 2 files to create a bingo.html and bingo.php file and placed them both in My Documents. The only thing that renders when I launch the html file is the text “Buzzword Bingo”. I even added the line recommended by ScubaDvr2. Also, I did notice that your Step 7 shows a php include, while your sample file is include once.

  • RGuinn

    Great, I am going to use this tomorrow night at our woodturners meeting/demo. Changed all the buzzwords to woodturning words and give a prize to the first one to get BINGO!

  • Jimmy

    This works great unless you’re the one running the meeting. Then you have an incentive for bribery … >:)

  • http://www.heyraena.com raena

    @DuleyNoted, My Documents isn’t usually a place where PHP can execute. Try using a regular web server.

    Also, for a PHP inclusion to work properly, you need to either tell your web server to make .html files executable by PHP, or change bingo.html to something else with .php at the end. So I’m not sure your bingo.html file will work unless you do one of those things.

    If you don’t have a web server, try out XAMPP. It has Apache, PHP, MySQL, lots of other goodies, and runs locally right there on your machine. Free!

  • Courtney

    okay, lil challenge (and I’m not a programmer but I understand some logic)

    75 words, with 15 available randomly in each column.

    I host “indie rock bingo” and simply paste stickers of items randomly on bingo cards, and call them out as randomly as I humanly can, but I’d like to eventually move to a bingo generator with pictures (simple enough right, insert jpgs in the array?) where each icon corresponds to an actual bingo # and I can use my bingo cage.

  • Lawrence Okpor

    To DuleyNoted,
    You should save the first example as ‘bingo.php’ and the 2nd example with any name but it should have a .php extension. That should do it. If you have a problem mail me at lawokp@yahoo.com

  • xxparanormalxx

    greatness.

  • CamCrow

    Our staff did this (at my school) back in the fall; our principal gave us a sheet with a whole bunch of ministry/board terms (some would say BS as is listed above) at the top, and we were to put them in random boxes in a 5×5 grid. I’m our school’s webmaster, if I had this tool I could’ve generated a random sheet for each teacher! ;-)

  • ghydle

    that was fun – more of these fun examples please!!

  • Nathan

    Liking the bingo card. I’m learning PHP myself actually and finding it an interesting language. Posting to PHPmule.com/blog. Will be trying to learn more stuff like this in the future!

  • joro6430

    Thanks Raena – that worked just fine. Very amusing. However it broke when I added more words to the array. It performs as presented up to 29 words in the array, but crashes with 30 or more words. Can’t see anything wrong with your logic, is it the shuffle() function causing the bug? I cut out your code and substituted
    shuffle($buzzwords);

    $count=1;
    foreach ($buzzwords as $word) {
    echo “$count $word, “;
    $count++;
    }
    and this misbehaved similarly – breaking at the array size 30 words barrier. Anybody seen this (mis)behaviour before?

  • joro6430

    Mmmmm I can answer my own question now. It’s the usual story of pilot error I’m afraid. I messed up the array by omitting a comma on one of the buzz phrases. When that phrase was absent the software was fine, and now works great with lots of buzz phrases. As Dilbert has it, never underestimate the extent of human stupidity.

  • Robert K

    Brilliant! Perhaps accumulate a large list and stick it in a database? The you can print off multiple 10’s of sheets for everyone but the presenter to have a go :P