Doc #61578 [Com]: bin2hex() definition is ambiguous
| From: | phpmpan at mpan dot pl | Date: | Mon, 02 Apr 2012 11:41:15 +0000 |
| Subject: | Doc #61578 [Com]: bin2hex() definition is ambiguous | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-8157@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61578&edit=1
ID: 61578
Comment by: phpmpan at mpan dot pl
Reported by: unsure at tactileint dot com
Summary: bin2hex() definition is ambiguous
Status: Open
Type: Documentation Problem
Package: Documentation problem
Operating System: any
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
I see no ambiguity in the description.
According to function description your first interpretation is wrong. It is clearly stated that
bin2hex converts binary data, not a textual representation of a number in 2-based
positional numeral system:
"bin2hex â Convert binary data into hexadecimal representation"
Previous Comments:
------------------------------------------------------------------------
[2012-03-31 02:25:39] unsure at tactileint dot com
Description:
------------
---
From manual page: http://www.php.net/function.bin2hex#refsect1-function.bin2hex-description
---
"Returns an ASCII string containing the hexadecimal representation of str. The conversion is
done byte-wise with the high-nibble first. "
ambiguous. Which you mean?
'01101000' => '68' first nibble, 6, is higher order, 0110
or
'0110' => '30313130' first nibble, 3, is higher order in char '0'
= 30
In both cases the input string is 'binary'. Given that '123ABC' is considered
headecimal, doesn't it follow that '01101000' is binary?
Including a few unambiguous examples would solve the problem. Like:
bin2hex('or') => '6f72'
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61578&edit=1