Home >Backend Development >PHP Problem >How to convert asc to string in php

How to convert asc to string in php

藏色散人
藏色散人Original
2022-01-12 10:54:151879browse

php method to convert asc to character: 1. Create a PHP sample file; 2. Implement it through the code "$i = 65;$ch = chr($i);var_dump($ch);" Just convert ASCII code to characters.

How to convert asc to string in php

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

php How to convert asc to string ?

PHP - Conversion between ASCII code and characters

ASCII code to character:

<?php
$i = 65;
$ch = chr($i);
var_dump($ch);
?>

string 'A' (length=1)

Character conversion to ASCII code:

<?php
$ch = &#39;A&#39;;
$i = ord($ch);
var_dump($i);
?>

int 65

Recommended learning: "PHP Video Tutorial"

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

Statement:
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