Re: ereg_replace with user defined function?

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

 



# frank.arensmeier@xxxxxxxxxxxxxxxxx / 2006-10-11 14:28:21 +0200:
> Actually, - believe it or not - I have never written a class (I am  
> still learning PHP after three years working with that language). So  
> I am not quite sure of the benefits of your class.

    Nevermind then. I don't know how to fit my experience into a short
    email, so I'm not going to explain it, just replace the class with
    whatever pays the bill.

> Let me try to sum up:
> 
> With a preg_replace_callback I am able to look for a pattern like: a  
> number ( float or integer ) followed by whitespace followed by one,  
> two, three or more characters, followed by a closing character.
> 
> e.g.: "((\d{1,10}[,|.]*\d{0,10})*(\s)(\D{1,3})([$|\s|.|,|\)|/]+|$))" (untested)

    that's wrong unless you want e. g. these to match:

    1|2|3|4 (^)
    000000|,.|||| ~!@X
 
> If preg finds a match, it will pass an array to the specified  
> function. In that function I evaluate the unit, see if it is in my  
> array containing the conversion "table". If that is the case,  
> calculate the new value and return everything. Right?

    Yes.
 
> I will get back with this new approach.
> 
> BTW, 0.32/0.34 seconds includes: calling the original html page from  
> an outside server, loading this page into the DOM parser

    (...) ok then

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

-- 
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