I'm using the codeigniter framework and utilizing the uri->segment(); function
I have an array:
$brand_array = array("Alpine" => "Alpine", "Atrend" => "Atrend");
if ($this->uri->segment(3) && array_key_exists($this->uri->segment(3),
$brand_array)) {
$mm = $brand_array[$this->uri->segment(3)];
echo $mm;
}
I want to use PHP to trim any characters that do not equal an array value
so if the user types this into the url example.com/brands/DDDAlpine
I would want to trim all of those characters before Alpine
is this going to be a fairly complex function?
Will I need to use preg_replace and write my own string pattern?