note 88492 added to function.ord
| From: | regalia at umail dot ucsb dot edu | Date: | Mon, 26 Jan 2009 23:54:38 +0000 |
| Subject: | note 88492 added to function.ord | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-149809@lists.php.net to get a copy of this message | ||
Make sure that the parameter you are passing to the ord function is a string.
<?php
$num = 12345;
// Incorrect usage of square bracket notation
if(ord($num[0]) == 0) {
echo "Not a valid ASCII character";
}
// Using the substr method will account for any data type
if(ord(substr($num,0,1)) == 0) {
echo "Not a valid ASCII character";
}
?>
----
Server IP: 208.69.120.35
Probable Submitter: 169.231.3.11
----
Manual Page -- http://www.php.net/manual/en/function.ord.php
Edit -- https://master.php.net/note/edit/88492
Del: integrated -- https://master.php.net/note/delete/88492/integrated
Del: useless -- https://master.php.net/note/delete/88492/useless
Del: bad code -- https://master.php.net/note/delete/88492/bad+code
Del: spam -- https://master.php.net/note/delete/88492/spam
Del: non-english -- https://master.php.net/note/delete/88492/non-english
Del: in docs -- https://master.php.net/note/delete/88492/in+docs
Del: other reasons-- https://master.php.net/note/delete/88492
Reject -- https://master.php.net/note/reject/88492
Search -- https://master.php.net/manage/user-notes.php