title: php: the best way to check if string ends with an element from array?
body: <pre><code>$arr1 = array ("llo" "world", "ef", "gh" );
  </code></pre>
  
  <p>What's the best way to check if <code>$str1</code> ends with some string from <code>$arr1</code>? 
  The answer true/false is great, although knowing the number of $arr1 element as an answer (if true) would be great.</p>
  
  <p>Example:</p>
  
  <pre><code>$pos= check_end("world hello");//$pos=0; because ends with llo
  $pos= check_end("hello world");//$pos=1; because ends with world.
  </code></pre>
  
  <p>Is there any better/faster/special way than just comparing in for-statement all elements of <code>$arr1</code> with the end of <code>$str1</code>?</p>