|
Posted by Andy Jeffries on 05/18/06 21:33
On Thu, 18 May 2006 10:12:53 -0700, fakefaker123 wrote:
> Hi,
> Does anyone know what exactly this does:
Broken down:
ereg_replace("
Replace using simple regular expressions
[
A character in the following range
^
Anything but...
0-9
The digits 0-9
..
A full stop or decimal point
]
End of the range
", "",
With an empty string (i.e. delete)
$value)
In $value
So it removes any character from $value that isn't 0-9 or .
> would this be responsible for a negative number losing it's minus sign?
Yes. The - sign isn't listed in the range (i.e. it would be [^0-9.\-]) so
it will remove it from the output
> e.g, if @value is minus 2300.00 (-2300.00), then after the above
> function, is it still = -2300.00?
Nope, it'll be 2300.00
Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos
Navigation:
[Reply to this message]
|