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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: yo at yo dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 11:01:29 2025 UTC