note 54648 added to function.strstr
| From: | bonyiii at freestart dot hu | Date: | Mon, 11 Jul 2005 11:54:29 +0000 |
| Subject: | note 54648 added to function.strstr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91767@lists.php.net to get a copy of this message | ||
The function strstr is accept not only two parameters but three.
Hope you see, between the numbers it is a coma not a dot
$number="123432,32434";
"decimal_separator" is also a coma
$decimal_separator=",";
"swap" is a dot
$swap="."
So your code should look like this:
$number= strstr($number,$decimal_separator,$swap);
The result is the same number but with a dot between the numbers not a coma (123432.32434)
It only works with one character, but still it can be usefull, I found it in PEAR validate package.
Hope it helps somebody out there.
Cheers
----
Manual Page -- http://www.php.net/manual/en/function.strstr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54648
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54648&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54648&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54648&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54648&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54648&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54648&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54648&report=yes
Search -- http://master.php.net/manage/user-notes.php