How to convert numerical value to ascii in php

藏色散人
Release: 2023-03-14 17:06:01
Original
2195 people have browsed it

php method to convert numbers to ascii: 1. Create a PHP sample file; 2. Convert numbers to letters through the "function NumToASCII($num) {...}" method.

How to convert numerical value to ascii in php

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

How does php convert numerical values ​​into ascii?

PHP Convert numbers to letters ASCII

PHP Convert numbers to letters through ASCII

/**
 * @param int $num
 * @return bool|int $ascii
 */
function NumToASCII($num) {
    if(!isset($num) || !$num || !is_numeric($num)) {
        return false;
    }
    $ascii = $num + 64;
    return chr($ascii);
}
Copy after login

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to convert numerical value to ascii in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template