title: Check if string starts with in array values
body: <p>I have an array of excluded category IDs. I'm trying to fetch data from the DB and filter products based on this array.</p>
  
  <ul>
  <li><strong>1000</strong> is an example of <strong>Category Level 1</strong> ID </li>
  <li><strong>1000001</strong> is an example of <strong>Category Level 2</strong> ID </li>
  <li><strong>1000001021</strong> is an example of <strong>Category Level 3</strong> ID</li>
  </ul>
  
  <p>So if level 1 is excluded, products of level 2 and 3 are automatically excluded. Currently I'm doing this:</p>
  
  <pre><code>$excludedCategories = ['1000', '100011'];
  
  while ($row = $result-&gt;fetch_assoc()) {
      $category = "1". $row['category'] . $row['sub_category'] . $row['category_id'];
      foreach ($excludeCategories as $exCategory) {
          if( substr($category, 0, strlen($exCategory)) === $exCategory ) {
              echo 'Category'. $category . " matches " . $exCategory . "&lt;br&gt;";
              continue;
          }
      }
  }
  </code></pre>
  
  <p>.. but is there a better way of doing it without running the second loop?</p>