note 103170 added to function.gmp-init
| From: | karl dot debisschop at pearson dot com | Date: | Tue, 29 Mar 2011 20:15:46 +0000 |
| Subject: | note 103170 added to function.gmp-init | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-178324@lists.php.net to get a copy of this message | ||
Unless the base is 16, gpm_init will fail if the string begins with "0b".
> php -r '$v = gmp_init("b83", 17); print("$v\n");'
Resource id #4
> php -r '$v = gmp_init("0b83", 17); print("$v\n");'
[nothing prints]
In may case, where I am explicitly specifying the base, the solution is to apply ltrim first:
> php -r '$v = gmp_init(ltrim("0b83", "0"), 17);
> print("$v\n");'
Resource id #4
----
Server IP: 69.147.83.197
Probable Submitter: 192.251.134.5
----
Manual Page -- http://www.php.net/manual/en/function.gmp-init.php
Edit -- https://master.php.net/note/edit/103170
Del: integrated -- https://master.php.net/note/delete/103170/integrated
Del: useless -- https://master.php.net/note/delete/103170/useless
Del: bad code -- https://master.php.net/note/delete/103170/bad+code
Del: spam -- https://master.php.net/note/delete/103170/spam
Del: non-english -- https://master.php.net/note/delete/103170/non-english
Del: in docs -- https://master.php.net/note/delete/103170/in+docs
Del: other reasons-- https://master.php.net/note/delete/103170
Reject -- https://master.php.net/note/reject/103170
Search -- https://master.php.net/manage/user-notes.php