Reply to Re: A puzzle about leading zeros

Your name:

Reply:


Posted by Jerry Stuckle on 08/22/05 04:32

TheTeapot wrote:
> Hi all,
>
> Here's a puzzle:
> // Say I have an array of numbers set up like so:
> $arr = array(15,16,17,100,121,1000);
>
> // How can I create a function so that I can use it like so:
> addleadingzeros_arr($arr);
>
> // and have the output look like:
> // array("0015","0016","0017","0100","0121","1000");
>
> Or, if the function only does one value like shown, so I can loop the
> array through, modifying each seperately.
> addleadingzeros_int(32);
> // Outputs: "0032"
>
> I'd prefer the first one though.
>
> Thanks,
> TheTeapot
>

One thing to think about. "0121" as an integer is equivalent to 81. Numbers
with leading zeros are octal.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация