FUDforum - خوراک RDF
http://fudforum.org/forum/index.php
converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183889&th=123300#msg_183889
for a given value.
for x=65 to 90
print chr$(x)
next x
would give ABCDEF......
how is this done in php?]]>Mr Oldies2013-11-24T16:58:34-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183890&th=123300#msg_183890
<noreply@example.com> 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?
for ($x = 65; $x <=90; ++$x)
printf("%c",$x);
HTH
--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request]]>Lew Pitcher2013-11-24T17:06:49-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183891&th=123300#msg_183891
> 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]]>Luuk2013-11-24T17:21:43-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183892&th=123300#msg_183892
> On Sunday 24 November 2013 11:58, in comp.lang.php, "richard"
> <noreply@example.com> 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?
>
> for ($x = 65; $x <=90; ++$x)
> printf("%c",$x);
>
>
> HTH
>
for ($x = 65; $x <91; $x++)
echo($x);
--
Ineptocracy
(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.]]>The Natural Philosoph2013-11-24T17:42:01-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183895&th=123300#msg_183895
> 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]]>Mr Oldies2013-11-24T18:15:41-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183896&th=123300#msg_183896
Philosopher" <tnp@invalid.invalid> wrote:
> On 24/11/13 17:06, Lew Pitcher wrote:
>> On Sunday 24 November 2013 11:58, in comp.lang.php, "richard"
>> <noreply@example.com> 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?
>>
>> for ($x = 65; $x <=90; ++$x)
>> printf("%c",$x);
>>
>>
>> HTH
>>
> for ($x = 65; $x <91; $x++)
> echo($x);
>
Nope. That just gets the numeric values of $x, not the ASCII (or other
characterset) equivalent.
HTH
--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request]]>Lew Pitcher2013-11-24T18:39:45-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183897&th=123300#msg_183897
> 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]]>J.O. Aho2013-11-24T20:53:33-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183898&th=123300#msg_183898
> "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?
>
> for ($x = 65; $x <=90; ++$x)
> printf("%c",$x);
There is a probably more efficient alternative to this shell-script/C like
way in PHP:
PointedEars
--
> If you get a bunch of authors […] that state the same "best practices"
> in any programming language, then you can bet who is wrong or right...
Not with javascript. Nonsense propagates like wildfire in this field.
-- Richard Cornford, comp.lang.javascript, 2011-11-14]]>Thomas 'PointedEars' 2013-11-24T21:46:48-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183899&th=123300#msg_183899
> Lew Pitcher wrote:
>> "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?
>
> […]
> $ php -r 'var_dump(implode("", array_map("chr", array_keys(array_fill(65,
> 26, true)))));'
> string(26) "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
PointedEars :)
--
When all you know is jQuery, every problem looks $(olvable).]]>Thomas 'PointedEars' 2013-11-24T22:01:40-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183902&th=123300#msg_183902
noreply@example.com> wrote in news:1os8m6ou5g6i4$.1n33ilnevl0le.dlg@
40tude.net:
> 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://lmgtfy.com/?q=convert+number+to+ascii+value+using+php]]>Doug Miller2013-11-25T02:47:59-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183903&th=123300#msg_183903
user@example.net> wrote in news:bff7adFecqpU1@mid.individual.net:
>
> for-loop works fine, you can also use foreach-loop if you have a list of
> keys stored in a variable.
>
You don't understand. RtS isn't asking for someone to tell him how to write it -- he's asking for
someone to write it for him.]]>Doug Miller2013-11-25T02:50:36-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183904&th=123300#msg_183904
> richard <noreply@example.com> wrote in news:1os8m6ou5g6i4$.1n33ilnevl0le.dlg@
> 40tude.net:
>
>> 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://lmgtfy.com/?q=convert+number+to+ascii+value+using+php
http://lmgtfy.com/?q=shove+it+up+your+ass]]>Mr Oldies2013-11-25T03:30:38-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183905&th=123300#msg_183905
> "J.O. Aho" <user@example.net> wrote in news:bff7adFecqpU1@mid.individual.net:
>
>>
>> for-loop works fine, you can also use foreach-loop if you have a list of
>> keys stored in a variable.
>>
> You don't understand. RtS isn't asking for someone to tell him how to write it -- he's asking for
> someone to write it for him.
>
Doug,
J.O. understands Richard quite well. But for others reading the
newsgroup, J.O.'s update can be helpful.
And I see Richard has his usual (lack of) intelligent response to you.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attglobal.net
==================]]>Jerry Stuckle2013-11-25T03:36:31-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183906&th=123300#msg_183906
> 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?
Or in other words, just about the same way it is in basic, but using the
equivalent php control structures and functions instead.
--
Denis McMahon, denismfmcmahon@gmail.com]]>Denis McMahon2013-11-25T03:40:09-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183908&th=123300#msg_183908
> On 11/24/2013 9:50 PM, Doug Miller wrote:
>> "J.O. Aho" <user@example.net> wrote in
>> news:bff7adFecqpU1@mid.individual.net:
>>
>>>
>>> for-loop works fine, you can also use foreach-loop if you have a list of
>>> keys stored in a variable.
>>>
>> You don't understand. RtS isn't asking for someone to tell him how to
>> write it -- he's asking for
>> someone to write it for him.
>>
>
> Doug,
>
> J.O. understands Richard quite well. But for others reading the
> newsgroup, J.O.'s update can be helpful.
Thanks for replying for me, you are spot on as usually.
> And I see Richard has his usual (lack of) intelligent response to you.
It's his problem.
--
//Aho]]>J.O. Aho2013-11-25T05:47:13-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183910&th=123300#msg_183910
noreply@example.com>
wrote:
And you wonder why people only help you once...
--
To reply via e-mail, remove The Obvious and .invalid from my e-mail address.]]>Evan Platt2013-11-25T06:12:54-00:00Re: converting numbers to ascii values
http://fudforum.org/forum/index.phpindex.php?t=rview&goto=183915&th=123300#msg_183915
> 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......
no, it gives:
A
B
C
D
......
>>>
>>> how is this done in php?
> What is a good way to do that?
>
> BASIC style
>
> x=65
> while x<91
> a$=chr$(x)
> print a$
> x=x+1
> wend
>
>
this also gives:
A
B
C
D
......
What about trying to copy this to PHP:
$x=65;
while ($x<91) {
a$=chr($x);
print $a;
$x=$x+1;
}