note 62923 deleted from function.ctype-print by colder

From: Date: Fri, 23 Feb 2007 12:35:31 +0000
Subject: note 62923 deleted from function.ctype-print by colder
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-123760@lists.php.net to get a copy of this message
Note Submitter: pcdinh at gmail dot com ---- 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.

« previous php.notes (#123760) next »