Re: How to take video embed codes and change all their widths/heights?
| From: | Jochem Maas | Date: | Tue, 15 Jan 2008 23:37:47 +0000 |
| Subject: | Re: How to take video embed codes and change all their widths/heights? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-267339@lists.php.net to get a copy of this message | ||
Daniel Brown schreef:
..
$embed_code = preg_replace('/height="([0-9]*)"/U','height="'.$height.'"',preg_replace('/width="([0-9]*)"/U','width="'.$width.'"',$embed_code));I wouldn't have given him the complete regexp - how will they ever learn. :-) BUT $embed_code = preg_replace( array('/height="([0-9]*)"/U', '/width="([0-9]*)"/U') array('height="'.$height.'"', 'width="'.$width.'"'), $embed_code); i.e. save the nested calls to preg_replace() when's the last time you read the manual man-with-really-long-name? :-P
echo $embed_code."\n"; ?>