Re: http_build_query ... argh

From: Date: Fri, 10 Nov 2006 11:26:53 +0000
Subject: Re: http_build_query ... argh
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-244463@lists.php.net to get a copy of this message
Arpad Ray wrote: > Jochem Maas wrote: >> function inputPostQueryUnBorker($s) >> { >> return preg_replace('#(\?|&(?:amp;)?)([^=]*)=#eU', >> >> "'\\1'.str_replace(array('%5B','%5D'), >> array('[',']'), '\\2').'='", >> $s); >> } >> >> so how bad is it > This is a bit more concise. I doubt there'd be a noticable difference in > speed though: > > return preg_replace('#%5[bd](?=[^&]*=)#ei', > 'urldecode("\0")', $s); nice! - although I had to test your regexp, I can't figure out exactly what it's doing but it seems to work exactly like mine... could you explain your regexp - I'd like to replace my version with your (if for no other reason than that shorter code is easier to read than longer code!) BUT until I really understand your regexp I'd feel 100% comfortable making the replacement. kinds regards, Jochem ps - sometimes reading regexps is a lot harder than writing them! > > Arpad

« previous php.general (#244463) next »