Re: Character Problem
| From: | John Lim | Date: | Wed, 25 Feb 2004 12:20:00 +0000 |
| Subject: | Re: Character Problem | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-22965@lists.php.net to get a copy of this message | ||
The most elegant way is probably:
<?php
for ( $i = 0; $i <=255; $i++ )
Dictionary[] = chr($i);
?>
"Meteorlet Woody" <meteorlet@sjtu.edu.cn> wrote in message
news:20040225104529.D9D0010A3EE1@sjtu.edu.cn...
>
> I got it.
>
> <?php
> for ( $i = 0; $i <= 255; $i++ )
> {
> $Dictionary[] = sprintf("%c",$i);
> }
> ?>
>
> ======= 2004-02-25 18:00:06 =======
>
> >Hi,everyone!
> >
> > When I want to create a character dictionary,I meet a problem.
> >The problem is that how to put the characters (256 ASCII,including
nonprintable)
> >in an array in one loop.
> >
> > I can do like this:
> > <?php
> > Dictionary[] = "\x00";
> > Dictionary[] = "\x01";
> > ......
> > Dictionary[] = "\xFF";
> > ?>
> >
> > But when I want to do by using loop,it doesn't work.
> > <?php
> > for ( $i = 0; $i <=255; $i++ )
> > Dictionary[] = "\x$i"; // it doesn't work!!!
> > ?>
> >
> >Is there anyone who has any idea or hint to solve this problem?
> >Thank you so much in advance.
> >
> >Meteorlet
> >meteorlet@sjtu.edu.cn
> >2004/2/25
> >
> >--
> >PHP Windows Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> = = = = = = = = = = = = = = = = = = = =
>
> ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Meteorlet Woody
> ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡meteorlet@sjtu.edu.cn
> ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2004-02-25
>