betwin
asked on
Replace HTML tag attribute values using regex & php
Hello,
I have a php function that spits out some HTML tags.
Could you help me write a regex that replaces all values of the width attribute by 300, and stores the old width in a variable.
Many thanks
I have a php function that spits out some HTML tags.
Could you help me write a regex that replaces all values of the width attribute by 300, and stores the old width in a variable.
Many thanks
<?php
$oldwidth="";
$string = '<object width="400" height="325"><param name="movie" value="http://www.youtube.com/v/b9JAHhqV6Ko&rel=0&egm=0&showinfo=0&fs=1"></param><param name="wmode" value="transparent"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/b9JAHhqV6Ko&rel=0&egm=0&showinfo=0&fs=1" type="application/x-shockwave-flash" width="400" height="325" allowFullScreen="true" wmode="transparent"></embed></object>';
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
NP. Glad to help : )
ASKER