PHP Classes

Was wondering why search and replace data structures are not ...

Recommend this page to a friend!

      BBCode Parser Class  >  All threads  >  Was wondering why search and replace...  >  (Un) Subscribe thread alerts  
Subject:Was wondering why search and replace...
Summary:Package rating comment
Messages:3
Author:RicardoSaracino
Date:2010-12-07 16:26:04
Update:2010-12-07 17:42:30
 

RicardoSaracino rated this package as follows:

Utility: Good
Consistency: Good
Documentation: Not sure
Examples: Not sure

  1. Was wondering why search and replace...   Reply   Report abuse  
Picture of RicardoSaracino RicardoSaracino - 2010-12-07 16:26:08
Was wondering why search and replace data structures are not in a single associative array?

Really nice implementation, was thinking of implementing something similar but with a subset of tags

  2. Re: Was wondering why search and replace...   Reply   Report abuse  
Picture of Ramunas Ramunas - 2010-12-07 17:38:27 - In reply to message 1 from RicardoSaracino
Thanks for rating this class!
The answer to your question is that it's because of preg_replace function declaration. It has individual parameters for search patterns array and replacements array.
See http://php.net/manual/en/function.preg-replace.php for details.
If I had one associative array, I would have to separate array keys from values. I just didn't want to do that :)

  3. Re: Was wondering why search and replace...   Reply   Report abuse  
Picture of RicardoSaracino RicardoSaracino - 2010-12-07 17:42:30 - In reply to message 2 from Ramunas
Makes perfect sense, i'm sure if i would have really *read* the code instead of skimming it i would have noticed.