How do I incorporate an if-statement within my array to hide/display a link? Using the coding snippet below, how would I write the code to display the "Change" link only when the value in status is "A"?

I think i'm making this harder than it has to be, but the use of both drupal module structure and php are throwing me, since i am just learning module development.

The link showing in the array below appears at the end of each of my rows. I only want it to appear when the status equals "A".

Because this link is within this array, i can't figure out how and where to implement it. I just want an [if statement] like this:

if (drupal_render($form['status'][$key]['status']) == 'A',)
echo l(t('Change'), 'rooms/avail_room/' . $key . '/' . arg(1), array('attributes' =&gt; array('class' =&gt; 'room-stat-avail'))),
else{
echo "";
}


so when the html table is displayed, the 'Change' link will only appear in the last column when the value of status is "A"

Can't believe I got the module working, but can't turn this link on/off as i want. See code snippet below:

function team_room_available_form($form) {
    $output = "No space available.";

  if ($form['roomid']) {
    foreach (element_children($form['roomid']) as $key) {
      $rows[] = array(
        'data' =&gt; array(
          drupal_render($form[''][$key]),
          drupal_render($form['room_title'][$key]),
          drupal_render($form['username'][$key]),
          drupal_render($form['status'][$key]['status']),
          l(t('Change'), 'rooms/avail_room/' . $key . '/' . arg(1), array('attributes' =&gt; array('class' =&gt; 'room-stat-avail'))),
        ),
        'class' =&gt; $form['status'][$key]['#value'],
      );
    }
You can use below code snippets: 

$field = $form['status'][$key]['status'];

if (strip_tags($field) == 'A') 
echo l(t('Change'), 'rooms/avail_room/' . $key . '/' . arg(1), array('attributes' =&gt; array('class' =&gt; 'room-stat-avail'))),
else{
echo "";
}