php and preg_replace?

evachick156

New member
Am i doing this wrong? Here is the code:
$t['kitty'] = "Cat - Adult (Female)";
$type = preg_replace("Cat - ", "", $t['kitty']);

I want $type to be "Adult (Female)"...I tried trim before but i found if i had the same letters it would erase them. Please help.
 
Hey there...try this out:

$t['kitty'] = "Cat - Adult (Female)";
$pattern[0] = "/Cat - /";
$type = preg_replace($pattern, "", $t['kitty']);
 
Back
Top