php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #50648 Format for binary numbers
Submitted: 2010-01-04 11:50 UTC Modified: 2011-07-27 00:16 UTC
From: robert_xp at gmx dot net Assigned: pajoye
Status: Closed Package: Scripting Engine problem
PHP Version: 5.4 OS:
Private report: No CVE-ID:
 [2010-01-04 11:50 UTC] robert_xp at gmx dot net
Description:
------------
I think it would be a good improvement to have a short form for binary numbers like C# with 0b101010. More information and a patch is provided here: http://www.xarg.org/2009/12/php-hacking/

Reproduce code:
---------------
0b0000101

Expected result:
----------------
5

Actual result:
--------------
compile-error

Patches

php-src-trunk-50648_p2.patch (last revision 2010-11-29 16:36 UTC) by jonah dot harris at gmail dot com)
php-src-5.3-50648_p1.patch (last revision 2010-11-11 06:06 UTC) by jonah dot harris at gmail dot com)
phpdoc-50648_p1.patch (last revision 2010-11-11 05:08 UTC) by jonah dot harris at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-11 07:15 UTC] jonah dot harris at gmail dot com
Per discussion, two patches are attached:

- php-src-5.3-50648_p1.patch is a subset and clean up of Robert's original patch 
for binary notation of integer support.

- phpdoc-50648_p1.patch is an English documentation update.

NOTE: re2c will have to be run post-patch and pre-commit because the re2c-related 
diffs could not be included as they pushed the patch size over 100K.
 [2010-12-01 16:25 UTC] jani@php.net
-Package: Feature/Change Request +Package: Scripting Engine problem
 [2011-07-27 00:16 UTC] pajoye@php.net
-Status: Open +Status: Closed -PHP Version: 5.3.1 +PHP Version: 5.4 -Assigned To: +Assigned To: pajoye
 [2011-07-27 00:16 UTC] pajoye@php.net
I applied the pach to 5.4 and trunk. Thanks for your work!

It would rock if you would have some time to add some test cases, string 
conversion, etc.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 22:02:16 2014 UTC