title: PHP string comparison when string ending can contain random numbers
body: <p>I need to make the PHP below work.  I basically need to take a string stored in <code>$sshCommandResponseString</code> and check to see if it contains 1 of 4 possibble strings.</p>
  
  <pre><code>start: Job is already running: mysql
  mysql start/running, process 8019
  mysql stop/waiting mysql start/running, process 8348
  stop: Unknown instance: mysql start/running, process 8693
  </code></pre>
  
  <p>The last 3 string end with a 4 digit number which will always be a different value.  So I cannot do a simple if/else check like the function below does as the string will sometimes end with a 4 digit number!</p>
  
  <p>So what is the best way to check to see if my string matches 1 of these 4 strings?</p>
  
  <pre><code>function didMySqlDbRestart($sshCommandResponseString){
  
      if( $sshCommandResponseString == 'start: Job is already running: mysql' ){
          return true;
      }else if( $sshCommandResponseString == 'mysql start/running, process 8019' ){
          return true;
      }else if( $sshCommandResponseString == 'mysql stop/waiting mysql start/running, process 8348' ){
          return true;
      }else if( $sshCommandResponseString == 'stop: Unknown instance: mysql start/running, process 8693' ){
          return true;
      }else{
          return false;
      }
  }
  
  if(didMySqlDbRestart($sshCommandResponseString)){
      echo 'SUCCESS: MySQL Database Rebooted';
  }else{
      echo 'ERROR: MySQL Database Did Not Reboot';
  }
  </code></pre>
  
  <hr>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Adding on to user Laser's answer perhaps something like this would be ok...</p>
  
  <pre><code>  function didMySqlDbRestart($sshCommandResponseString){
      if(preg_match('/^.*\d{4}$/', trim($sshCommandResponseString)) &gt; 0){
          return true;
      }else if($sshCommandResponseString == 'start: Job is already running: mysql'){
          return true;
      }else{
          return false;
      }
    }
  </code></pre>