You are here: Re: ereg_replace question « PHP Programming Language « IT news, forums, messages
Re: ereg_replace question

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация