note 84341 added to function.chr

From: Date: Wed, 09 Jul 2008 22:34:54 +0000
Subject: note 84341 added to function.chr
Groups: php.notes 
Request: Send a blank email to php-notes+get-141336@lists.php.net to get a copy of this message
First, the linefeed versus carriage return confusion: When typewriters were first invented they were manually moved. You could do a couple of things with them. You could type on it (which would move the carriage one space to the left as you typed each character), you could hit the backspace key (which would move the carriage one space to the right), press the line feed button (which would cause the carriage to roll up one line), and return (which would move the carriage all the way to the right again). When electric typewriters came in to being these functions were made into their electronic counterparts. When terminals appeared they were given the same functions just as word processors, text editors, and everything else that deals with the typed word handles them. When computers first came out though, the dopey people who invented them wanted to distinguish themselves. One of the ways they did that was to only use some of the commands. Which is why the Macintosh originally only used the carriage return command and why Linux/Unix only used the line feed command. This is why there is "\r" (carriage return), "\l" (Line Feed), and "\n" (OS appropriate). One of the few things that IBM got right was that it should really be <Carriage Return><Line Feed> and not just one or the other. So like the reason our roads are a certain width is because that was the width of two horses pulling a Roman chariot, the reason we use these terms is because of the humble non-electronic typewriter and how it worked. Second - I believe that PHP actually generates ANSI characters and not ASCII characters. Although there were different extended character sets for the ASCII characters (ie: 128-255), the one depicted on the http://www.asciitable.com/ website clearly shows the IBM standardized ASCII extended table. (ie: If you ran a BASIC program on your computer you would see the set shown on the above website.) If, however, you print out the characters via the CHR() function in PHP it prints out the ANSI character set. (ASCII and ANSI are the same for 0-127.) Although you can get the characters to print (via Unicode) through the CHR() function - this is still simply showing it is using ANSI and not ASCII. (Because Unicode is an extension of the ANSI character set and not the ASCII character set.) If this is so (and my tests show it is) - should the documentation be changed to reflect this? :-? ---- Server IP: 209.41.74.194 Probable Submitter: 143.111.22.24 ---- Manual Page -- http://www.php.net/manual/en/function.chr.php Edit -- https://master.php.net/note/edit/84341 Del: integrated -- https://master.php.net/note/delete/84341/integrated Del: useless -- https://master.php.net/note/delete/84341/useless Del: bad code -- https://master.php.net/note/delete/84341/bad+code Del: spam -- https://master.php.net/note/delete/84341/spam Del: non-english -- https://master.php.net/note/delete/84341/non-english Del: in docs -- https://master.php.net/note/delete/84341/in+docs Del: other reasons-- https://master.php.net/note/delete/84341 Reject -- https://master.php.net/note/reject/84341 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#141336) next »