note 88492 deleted from function.ord by hholzgra

From: Date: Thu, 02 Aug 2012 11:44:45 +0000
Subject: note 88492 deleted from function.ord by hholzgra
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-189603@lists.php.net to get a copy of this message
Note Submitter: regalia at umail dot ucsb dot edu ---- 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"; } ?>

« previous php.notes (#189603) next »