Page 1 of 1

question about modifying an integer..

Posted: Fri Aug 30, 2002 7:39 am
by Gonik
hello, first post here :)

anyway here's my question. Let's assume that I have the integer 100. I want to add a dot (.) AFTER the first digit, so it will become 1.00. I have many integer like this stored in a db. I think that I will do it using the ereg() function, but can you please give me a clue?

thank you!

Posted: Fri Aug 30, 2002 7:47 am
by volka
try

Code: Select all

$number=preg_replace('!^(ї0-9])(.*)!', '$1.$2', $number)

Posted: Fri Aug 30, 2002 8:35 am
by Gonik
Yes it worked! thank you m8! :)