#35976 [Opn->Bgs]: (string) type casting does not work
| From: | derick@php.net | Date: | Thu, 12 Jan 2006 08:19:28 +0000 |
| Subject: | #35976 [Opn->Bgs]: (string) type casting does not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-91787@lists.php.net to get a copy of this message | ||
ID: 35976
Updated by: derick@php.net
Reported By: localhost dot 80 at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows XP SP2
PHP Version: 5.1.1
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
The number "41058756689456878" definitely doesn't fit in the integer
range, and does PHP converts it to a float. There is no bug here.
Previous Comments:
------------------------------------------------------------------------
[2006-01-12 07:23:40] localhost dot 80 at gmail dot com
Description:
------------
The (string) type casting statement does not convert to string
Reproduce code:
---------------
<?php
$credit_card_number = 41058756689456878;
$tempCCN = (string)$credit_card_number;
$last_four_digits = substr($tempCCN,0,4);
$cardLength = strlen($credit_card_number);
function repeatChar($singleChar,$repeatTimes){
$returnThis = "";
$j = 0;
while($j<$repeatTimes){
$returnThis .= $singleChar;
$j++;
}
return($returnThis);
}
print(repeatChar("*",((int) $cardLength - 8)) . $last_four_digits);
?>
Actual result:
--------------
************4.10
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35976&edit=1