How can I check whether a variable contains some specific text
<p>how do I check if a variable in php contains text?  </p>

<p>eg:  </p>

<blockquote>
  <p>if ($cn contains 'excel') { ... }</p>
</blockquote>

<p>I've currently got the following that works but it is clumsy for if a course name changes then it will not work anymore.</p>

<pre><code>if (strpos($cn,'MS Excel 2003/07 (Intro)') !== false) {
...........
}
if (strpos($cn,'MS Excel 2003/07 (Intermediate)') !== false) {
...........
}
if (strpos($cn,'MS Excel 2003/07 (Special)') !== false) {
...........
}
</code></pre>
