note 62923 added to function.ctype-print

From: Date: Sun, 12 Mar 2006 12:43:49 +0000
Subject: note 62923 added to function.ctype-print
Groups: php.notes 
Request: Send a blank email to php-notes+get-105368@lists.php.net to get a copy of this message
This function has problems with string quoted with single quotes. This code proves that <?php $ch = chr(\\\'%0A\\\'); $strings = array(\\\'string1\\\' => \\\'asdf\\\\n\\\\r\\\\t\\\', \\\'string2\\\' => $ch); foreach ($strings as $name => $testcase) { if (ctype_print($testcase)) { echo \\\"The string \\\'$name\\\' consists of all printable characters.\\\\n\\\"; } else { echo \\\"The string \\\'$name\\\' does not consist of all printable characters.\\\\n\\\"; } } ?> returns The string \\\'string1\\\' consists of all printable characters. The string \\\'string2\\\' does not consist of all printable characters. So always quote your strings with double quotes. ---- Server IP: 66.163.161.117 Probable Submitter: 69.61.55.154 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.ctype-print.php Edit -- http://master.php.net/note/edit/62923 Del: integrated -- http://master.php.net/note/delete/62923/integrated Del: useless -- http://master.php.net/note/delete/62923/useless Del: bad code -- http://master.php.net/note/delete/62923/bad+code Del: spam -- http://master.php.net/note/delete/62923/spam Del: non-english -- http://master.php.net/note/delete/62923/non-english Del: in docs -- http://master.php.net/note/delete/62923/in+docs Del: other reasons-- http://master.php.net/note/delete/62923 Reject -- http://master.php.net/note/reject/62923 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#105368) next »