php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #12012 dec2bin and bin2dec
Submitted: 2001-07-10 10:52 UTC Modified: 2002-04-28 19:39 UTC
From: yo at yo dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.6 OS: Any
Private report: No CVE-ID: None
 [2001-07-10 10:52 UTC] yo at yo dot com
hi, can you please implement these functions in a future release ?

a binary to decimal converter:
     int bin2dec(string binstr);
and a decimal to binary converter:
     string dec2bin(int decvalue);

thanks

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-10 14:22 UTC] jeroen@php.net
Take a look at 
http://www.php.net/bindec
and
http://www.php.net/decbin

They already exist...

 [2001-07-10 14:33 UTC] jeroen@php.net
Hm, I now see that bindec('10101010001') is the syntax, and not a few bytes or something. That is not (yet?) implemented.

I'm not sure this should be in PHP. PHP isn't meant to work with binary files. I think that usually there are better alternatives, for example if you're after saving a few bytes of diskspace, this isn't the way to go.
 [2002-04-28 19:39 UTC] jimw@php.net
bindec() and decbin() are exactly what the original request was about.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 12:01:30 2024 UTC