Help documenting 3 new functions for CI 1.5.5 |
[eluser]Derek Allard[/eluser]
Wow! Thanks aart-jan and Zacharias! @BoltClock, I'd be very interested in seeing what you've found. Could you post sample code to show me, and also your proposed solution?
[eluser]BoltClock[/eluser]
It's just a little oversight, really. When I looked in the helper (which was before I noticed this topic BTW), I saw this: Code: function reduce_multiples($str, $character = ',', $trim = FALSE) But it's a PCRE function so $character supplied as either the pound itself or metacharacters (()[]{}/^$.-+*) would make preg_replace() spit a warning, so I just escaped $character with preg_quote() and made the command only look for actually multiple instances to make life easier for it: Code: function reduce_multiples($str, $character = ',', $trim = FALSE) That should do it. For what it's worth, I did a quick test and found it at least 5 times faster too!
[eluser]Derek Allard[/eluser]
Thanks all for your help and input. Your suggestions have been incorporated, as has the doc write up (thanks aart-jan!)
[eluser]BravoAlpha[/eluser]
[quote author="BoltClock" date="1197068229"] Code: $preg_chars = preg_quote($character, '#') . preg_quote($character, '#'); Do you really need to quote the character twice? Code: function reduce_multiples($str, $character = ',', $trim = FALSE)
[eluser]Majd Taby[/eluser]
Derek, while your eyes are on this thread (sorry for being off topic), under "Showing Errors Individually" in http://ellislab.com/codeigniter/user-gui...ation.html, I think there are missing code and pre tags.
[eluser]Derek Allard[/eluser]
Thanks Zaatar. Already caught and fixed in the SVN... it seems like my whole life is spent in that thing |
Welcome Guest, Not a member yet? Register Sign In |