Hi I have to remove a part of a string. The code is as follow:-
$string = "19Apr2016";
$search = '_'.$string;
$v1 = "DA6220_19Apr2016";
$v1 = preg_replace("([$search])", "", $v1);
echo $v1 ;
The following code only returns D as output. I want remove _19Apr2016 from the string. Please point out what i am doing wrong.
preg_replace("/$search/", "", $v1);