Looking at your initial $code variable, it is not correct.
- You are using double quotes nested in double quotes.. the inner double quotes must be escaped. So I used single quotes with inner double quotes.
- Your src does not encapsulate anything in quotes.
I made changes to your $code line, plugged in some numbers, then came up with this solution.
Would this work?
$code = '<embed src="blah blah blah blah" width="123" height="123"></embed>';
$newvidsize = array('width="425"', 'height="350"');
$codeUpdated = preg_replace('#(width="\d+" height="\d+")#', "$newvidsize[0] $newvidsize[1]", $code);
echo $codeUpdated;
Ouput (viewable via right-click and viewing source):
<embed src="blah blah blah blah" width="425" height="350"></embed>