On Jan 15, 2008 6:37 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> 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. :-)
Right, but for something that simple, I don't see the harm in
pointing in the proper direction. If someone can learn faster than I
was able to teach myself by my helping them, everyone benefits.
> 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()
Mine may look like a run-on sentence, but there's also less
parsing and processing involved. Fewer cycles lead to faster scripts.
(Even if yours DOES look nicer.... ;-P)
> when's the last time you read the manual man-with-really-long-name? :-P
I have to admit, Jochem, I don't get it. My name is one of the
shortest and plainest on the list (Dan Brown).... zip me a message
off-list so that I don't feel as though I'm missing out on a joke.
I'm guessing I'm just not processing very well this morning.
--
</Dan>
Daniel P. Brown
Senior Unix Geek and #1 Rated "Year's Coolest Guy" By Self Since
Nineteen-Seventy-[mumble].
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php