<?php
$string = 'peach&apple77_0000AAA&dddd';
echo preg_replace('/(.*)(apple77[^&]*&)(.*)/', '$1$3', $string);
echo "\n";
$string = 'peach&apple77_0000AAA&dddd&green&yellow';
echo preg_replace('/(.*)(apple77[^&]*&)(.*)/', '$1$3', $string);
echo "\n";
?>