Doc #61578 [Opn->Nab]: bin2hex() definition is ambiguous

From: Date: Wed, 04 Apr 2012 09:50:50 +0000
Subject: Doc #61578 [Opn->Nab]: bin2hex() definition is ambiguous
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8165@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 Updated by: bjori@php.net Reported by: unsure at tactileint dot com Summary: bin2hex() definition is ambiguous -Status: Open +Status: Not a bug Type: Documentation Problem Package: Documentation problem Operating System: any PHP Version: Irrelevant Block user comment: N Private report: N New Comment: See phpmpan comment Previous Comments: ------------------------------------------------------------------------ [2012-04-02 11:41:14] phpmpan at mpan dot pl 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" ------------------------------------------------------------------------ [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

« previous php.doc.bugs (#8165) next »