Skip to content

string helper suggestions

Derek Jones edited this page · 5 revisions
Clone this wiki locally

Category:helper


/**
 * Code Igniter String Helpers
 *
 * @package    CodeIgniter
 * @subpackage    Helpers
 * @category    Helpers
 * @author    Dennis T. Kaplan
 * @CI alias    TaMeR
 */

/**
 * reverse strstr()
 *
 * Find first occurrence of a string
 * Returns part of haystack string from start to the first occurrence of needle
 * $haystack = 'this/that/theother';
 * $result = rstrstr($haystack, '/')
 * $result == this

 * @access    public
 * @param    string $haystack, string $needle
 * @return    string
 */    
function rstrstr($haystack,$needle)
{
    return substr($haystack, 0,strpos($haystack, $needle));
}
Something went wrong with that request. Please try again.