Re: How to take video embed codes and change all their widths/heights?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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";
?>



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux