php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #55742 Description of what happens if you pass a number
Submitted: 2011-09-20 15:59 UTC Modified: 2011-09-20 16:03 UTC
From: birke at d-scribe dot de Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.3.8 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: birke at d-scribe dot de
New email:
PHP Version: OS:

 

 [2011-09-20 15:59 UTC] birke at d-scribe dot de
Description:
------------
---
From manual page: http://www.php.net/function.ctype-alnum
---
There should be the following warning in the docs:

If you are passing in a number, ctype_alnum will return false for all numbers that do not represent alphanumeric character codes (see chr). 

Test script:
---------------
<?php
$myVar = 10;
echo ctype_alnum($myVar) ? "T" : "F"; // returns F
$myVar = 48;
echo ctype_alnum($myVar) ? "T" : "F"; // returns T, because ASCII 48 = "a"
$myVar = "10";
echo ctype_alnum($myVar) ? "T" : "F"; // returns T




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-20 16:03 UTC] birke at d-scribe dot de
-Status: Open +Status: Closed
 [2011-09-20 16:03 UTC] birke at d-scribe dot de
Not needed, the cytpe intro docs explain it.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 20:00:02 2026 UTC