I have an array that contains some strings, am trying to find particular string is present in an array, I tried to use array_search() it is working but it is searching for exact string, is there any way to find similar string and returns its position. Below is my example.
$prodInfoStr = 'banana_2_3_150';
$myArr = Array ( [0] => apple_3_1_180 [1] => apricot_4_100_65 [2] => banana_2_3_135 );
$searchRes = trim(array_search($prodInfoStr,$myArr ));
$searchRes returns 2. it is perfectly fine.
If I search for banana_2_4_200, result should return me 2 so that I can replace it.
banana_2_3_150in your$myArrapple_4_100_65? Should it returnapricot_4_100_65orapple_3_1_180?