$item->description = preg_replace("/\<center\>\<a href=\"(.*)\"\>\<img alt=\"\" src=\"(.*)\" \/\>\<\/a\>\<\/center\>/", "$2", $item->description);
But I need to put result $2 into string $item->image.
How to do it?
Try with:
$item->image = preg_replace("/.*\<center\>\<a href=\"(.*)\"\>\<img alt=\"\" src=\"(.*)\" \/\>\<\/a\>\<\/center\>.*/", "$2", str_replace("\n", '', $item->description));
How ever do not use regex for parsing html use instead DOM instead
$item->image how should be? You said that $2 should be assigned to $item->image.$2, but not all $item->description..* at the beginning and at the end of regex.