Re: base_convert bug?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14-07-28 09:21 AM, Ashley Sheridan wrote:

On 28 July 2014 13:59:25 BST, "Radek Krejča" <radek.krejca@xxxxxxxxxx> wrote:

Leading zeros are not important in a binary number. Any system can
detect that 00010000 == 10000. The leading zeros do not make a
difference when it comes to calculating the values.

[Radek Krejca]
Thank you. So I have to fill missing zeros by myself.

Radek

Yes, you can use printf or sprintf to do this. The manual lists ways of adding leading characters to a string (as this is what it essentially needs to be to preserve the leading zeros)

Might I suggest the str_pad() function whose entire purpose is to pad :)

Cheers,
Rob.
--
Phone: 613-822-9060    +++    Cell: 613-600-2836
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux