Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.php Subject: Re: converting numbers to ascii values Date: Sun, 24 Nov 2013 21:53:33 +0100 Lines: 45 Message-ID: References: <1os8m6ou5g6i4$.1n33ilnevl0le.dlg@40tude.net> <76p9ma-90i.ln1@luuk.invalid.lan> <41gyawpi8u1z.ymbr00ipuiwh.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net ZZAEp7eNpVg0ObRDu1ByrgGlSqGv77ndz7hivAtCANqBEvgf01 Cancel-Lock: sha1:ts9lPx5s1mI5Wz8II0MsLgQAmDo= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 In-Reply-To: <41gyawpi8u1z.ymbr00ipuiwh.dlg@40tude.net> Xref: csiph.com comp.lang.php:11961 On 24/11/13 19:15, richard wrote: > On Sun, 24 Nov 2013 18:21:43 +0100, Luuk wrote: > >> On 24-11-2013 17:58, richard wrote: >>> In BASIC I would run a for loop to print out the corresponding characters >>> for a given value. >>> >>> for x=65 to 90 >>> print chr$(x) >>> next x >>> >>> would give ABCDEF...... >>> >>> how is this done in php? >>> >> >> http://us1.php.net/manual/en/function.chr.php > > thanks that was what I was looking for. > In my array the key is one letter. > "A"=>array() > "B"=>array() > "C"=>array() > > I need to step through each character to get the list. > What is a good way to do that? > > BASIC style > > x=65 > while x<91 > a$=chr$(x) > print a$ > x=x+1 > wend > > for-loop works fine, you can also use foreach-loop if you have a list of keys stored in a variable. -- //Aho