Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!news.teledata-fn.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <20682103.Slq7mXpyxH@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sun, 24 Nov 2013 22:46:48 +0100 User-Agent: KNode/4.11.3 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. MIME-Version: 1.0 Lines: 38 NNTP-Posting-Date: 24 Nov 2013 22:46:52 CET NNTP-Posting-Host: 9b0d26c4.newsspool4.arcor-online.net X-Trace: DXC=?L5\Tn0YCH?RLigj];iP=84IUKDZm8W4\YJN X-Complaints-To: usenet-abuse@arcor.de Xref: csiph.com comp.lang.php:11962 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? > > 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: for ($i = 65; $i <= 90; ++$i) { echo chr($i); } And finally: $ php -r 'var_dump(implode("", array_map("chr", array_keys(array_fill(65, 26, true)))));' string(26) "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 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