Mon, 13/10/2008 - 22:39 — horuskol
<?php include_once('astrpos.php'); // or however you want to include it $needles = array( 'apple', 'banana', 'pear', 'orange' ); $haystack = 'The fruiterer has some bananas and apples today. Unfortunately, there are no oranges, but the pears will be in tomorrow.'; // this will return the position of 'banana' - the first needle in the haystack echo astrpos($haystack, $needles) . '<br>'; // this will return the position of 'apple' - the first needle in the array of needles echo astrpos($haystack, $needles, 0, ASTR_NEEDLE_ORDER) . '<br>'; // this will return the position of 'orange' - the first needle in the haystack after the offset of 50 echo astrpos($haystack, $needles, 50) . '<br>'; // this will return the position of 'pear' - the first needle in the array of needles found after the offset of 50 echo astrpos($haystack, $needles, 50, ASTR_NEEDLE_ORDER) . '<br>'; ?>