FW: [PHP] String 2 Number
| From: | power jessie | Date: | Thu, 11 Oct 2001 02:54:02 +0000 |
| Subject: | FW: [PHP] String 2 Number | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-70627@lists.php.net to get a copy of this message | ||
yah he's right...
you can treat the string with the digits as number
<?php
$str = "3451";
$num = $str + 1;
?>
will result to 3452
but if u still want... try this
<?php
$str = "3451";
$num = sprintf("%d",$str);
?>
hope that helps.
jessie :)
-----Original Message-----
From: Dave Watkinson [mailto:d.watkinson@mightymatch.com]
Sent: Wednesday, October 10, 2001 4:25 AM
To: Saied Gerami; php-general@lists.php.net
Subject: RE: [PHP] String 2 Number
I don't think you need to - if it could be construed as a number PHP can
treat it as such
-----Original Message-----
From: Saied Gerami [mailto:gerami@d21.de]
Sent: 10 October 2001 12:31
To: php-general@lists.php.net
Subject: [PHP] String 2 Number
Hi,
Does anybody know how can I change a string containing only digits (like
"3451") to number?
Thanx,
Saied
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net