php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #55376 Type casting and type juggling are notsame 0x
Submitted: 2011-08-06 15:10 UTC Modified: 2011-08-17 11:04 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: riad93 at mail dot ru Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.3.6 OS: Ubuntu 11.04
Private report: No CVE-ID: None
 [2011-08-06 15:10 UTC] riad93 at mail dot ru
Description:
------------
I try to cast hex string with 0x to int I get 0 but
juggling returns not null value. Why?

Documentation of type casting and type juggling refers to 
http://www.php.net/manual/en/language.types.string.php#language.types.string.conv
ersion

Test script:
---------------
var_dump('0xD' * 1 );
var_dump((int)'0xD' * 1);

Expected result:
----------------
Same results. 0 or 13. I think, 0

Actual result:
--------------
int(13)
int(0)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-08-17 11:04 UTC] bjori@php.net
-Status: Open +Status: Bogus
 [2011-08-17 11:04 UTC] bjori@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

You are casting a string starting with 0 to an integer and then multiply it.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 19:00:01 2026 UTC