I'm trying to remove all data from the string after and including the "/"
$price="10/3"
I have tried preg_replace
$str = '2016/19';
$change = str_replace('/','-',$str);
$pattern = '/-*/';
$new = preg_replace($pattern,'',$change);
I tried doing it the way above because didn't know if there was issues with slashes so I changed the string to 2016-19 and then tried to replace the pattern But it doesn't remove the data following the -it simply removes the -
Also I can't do a substr because the amount of digits before the / and after change