|
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
==================
Navigation:
[Reply to this message]
|