title: If in_array on multidimensional array
body: <p>I have an array that looks as follows :</p>
  
  <pre>Array
  (
      [0] => Array
          (
              [bet_type] => 1
              [game_id] => 1627895
              [bet_id] => 1
              [team] => Paris SG
              [odds] => 29/100
              [line] => 0
          )
  
      [1] => Array
          (
              [bet_type] => 2
              [game_id] => 1642828
              [bet_id] => 1
              [team] => Derby County
              [odds] => 19/10
              [line] => 0
          )
  
  )
  </pre>
  
  <p>I need to check if a "game_id" exists within that array. So for example if <strong>1642828</strong></p>
  
  <p>My current PHP code is as follows :</p>
  
  <pre><code>    // Build An array titled Bet
      $bet = array(
          '0' =&gt; array(
              'bet_type'  =&gt;  $bet_type,
              'game_id'   =&gt;  $game_id,
              'bet_id'    =&gt;  $bet_id,
              'team'      =&gt;  urldecode($teamname),
              'odds'      =&gt;  $odds,
              'line'      =&gt;  $bet_line
          )
      );
  
      $betslip = $this-&gt;session-&gt;userdata('betslip');
  
      // Create The Betslip For The First Time...
      if(empty($betslip))
      {
          $this-&gt;session-&gt;set_userdata('betslip', $bet);
      }
      else
      {
          // Add To The Betslip Array...
          $betslip[] = array(
              'bet_type'  =&gt;  $bet_type,
              'game_id'   =&gt;  $game_id,
              'bet_id'    =&gt;  $bet_id,
              'team'      =&gt;  urldecode($teamname),
              'odds'      =&gt;  $odds,
              'line'      =&gt;  $bet_line
          );
  
          $this-&gt;session-&gt;set_userdata('betslip', $betslip);
      }
  </code></pre>
  
  <p>So my initial try was this :</p>
  
  <pre><code>if(!in_array($game_id, $betslip)
  {
    // Add To Slip
  }
  </code></pre>
  
  <p>This isn't working is there a way to do an if in_array on a multidimensonal array?</p>
  
  <p>Thanks</p>