array:3 [▼
0 => "main=apple-iphone+iphone-8"
1 => "brend=apple"
2 => "razreshenie-ekrana=1136x640+sxga2-1280x960+1334x750+1920x1080-1+2436h1125"
]
array:3 [▼
0 => "main=apple-iphone+iphone-8"
1 => "brend=apple"
2 => "razreshenie-ekrana=1136x640+sxga2-1280x960+1334x750"
]
$str = "razreshenie-ekrana=1136x640+sxga2-1280x960+1334x750+1920x1080-1+2436h1125";
$end_word = "1334x750";
echo substr($str, 0, stripos($str, $end_word) + strlen($end_word));
$source = [
0 => "main=apple-iphone+iphone-8",
1 => "brend=apple",
2 => "razreshenie-ekrana=1136x640+sxga2-1280x960+1334x750+1920x1080-1+2436h1125",
];
$stopWord = '1334x750';
$result = array_map(
function (string $str) use ($stopWord): string {
return preg_replace("/^(.*?$stopWord)(.*)/", '$1', $str);
},
$source
);
var_dump($result);