<?php  /**
 * @name Stringer for Kernel Web
 * @version 1.0
 * @copyright ArrayZone 2014
 * @license AZPL or later; see License.txt or http://arrayzone.com/license
 * @category plugin
 * 
 * This class manipulate strings
 */

class Stringer {
	/**
	 * @name getStringBetween
	 * This function get a string between two strings
	 * @param string $haystack String to read
	 * @param string $start String since start to read (this string not included)
	 * @param string $end String to read (this string not included)
	 * @param int $offset If specified, search will start this number of characters counted from the beginning of the string.
	 * @return string 
	 */
	static function getStringBetween($haystack, $start, $end = '', $offset = 0)  {
		// Initial position
		$posi =  strpos($haystack, $start) + strlen($start);
	
		// End position
		$pose = ($end != '') ? (strpos($haystack, $end, $posi) - $posi): '';
	
		// text between
		return substr($haystack, $posi, $pose);
	}
}
?>