Home  >  Article  >  Backend Development  >  10 recommended articles about the string function chr()

10 recommended articles about the string function chr()

怪我咯
怪我咯Original
2017-06-12 13:17:541861browse

The chr function is used to convert ASCII codes into characters ord function is used to convert characters into ASCII codes. ASCII code is the encoding of characters that can be displayed by the computer. Its value range is 0-255, including punctuation, letters, Numbers, Chinese characters, etc. During the programming process, specified characters are often converted into ASCII codes for comparison. The following is the function provided by PHP to convert ASCII codes and characters. 1. chr() function This function is used to convert ASCII code values ​​into strings. Its function declaration is as follows: string chr (int ascii); 2. ord() function This function is used to convert a string into an ASCII code value. The function declaration is as follows: int ord(string str); Example: Use the chr() function and ord() function to perform conversion operations between strings and ASCII codes. The program code is as follows: Copy the code as follows: Running result: X Y 83

1. How to score in word The chr and ord functions of PHP implement character addition, subtraction, multiplication and division operations Implementation code

Introduction: How to score in word: How to score in word PHP's chr and ord functions implement character addition, subtraction, multiplication and division operations Implementation code: chr function is used to convert ASCII codes to characters ord function is used to convert characters to ASCII codes ASCII codes are computers The encoding of characters that can be displayed, its value range is 0-255, including punctuation, letters, numbers, Chinese characters, etc. During the programming process, specified characters are often converted into ASCII codes for comparison. The following is the function provided by PHP to convert ASCII codes and characters. 1. chr() function This function is used to convert ASCII code values ​​into strings. The function declaration is as follows: string chr (int

##2. php chr() ord() Chinese interception garbled code problem solution_PHP tutorial

Introduction: How to solve the problem of garbled Chinese interception in php chr() ord(). Copy the code as follows: ?php $lenth = 19; $str = "How to display only the front of a long news title Some words should be replaced with...? "; echo strlen($str)=$lenth? $str: (sub

3. PHP Function Mastering the application of ord() and chr() functions_PHP Tutorial

10 recommended articles about the string function chr()

Introduction: PHP Functions Master the application of ord() and chr() functions. The third issue of the Chinese character encoding research series. Master the application of ord() and chr() functions in the PHP function chapter. In the previous issue [PHP Basics Chapter Detailed Explanation of ASCII Code Comparison Table and Character Conversion] Understood ASCII code and character conversion

4. Examples of defined() and strrchr() functions in PHP_PHP tutorial

Introduction: Examples of defined() and strrchr() functions in PHP. defined() function definition and usage The defined() function checks whether a constant exists, otherwise returns false. Example: ?php define(GREETING,Hello world!);

##5.

php strstr() strrchr() strpos() strrpos() function_PHP tutorial

Introduction: php strstr() strrchr() strpos() strrpos() function. These four functions are character operation functions, mainly to determine the number of times a character appears. Friends in need can refer to it. Click. Copy the code as follows?php //strstr: Search from left to right and return

##6.

Some common pitfalls when switching to PHP development_PHP tutorial

Introduction: Some common pitfalls when switching to PHP development. Some common pitfalls when switching to PHP development. 1. The strrchr function is commented on the W3School site as follows: strrchr() function search The last occurrence of a string in another string, and

7.

PHP interview questions: file directory operations, _PHP tutorial

Introduction: PHP interview questions about file directory operations. PHP interview questions: file directory operations, get file suffix, traverse directory hierarchy/* ** 5 ways to get file suffix name* This question is actually a test of the function substr() strrchr() array_pop() strrp

8.

strrchr() function returns wrong result sometimes?

Introduction: The result returned by the strrchr() function is sometimes incorrect?

9.

php chr() ord() Chinese interception garbled code problem solution

Introduction: Solution to the problem of php chr() ord() Chinese interception of garbled characters. Copy the code as follows: ?php $lenth = 19; $str = "How to display only the first few words of a long news title and replace it with...?"; echo strlen($str)=$ lenth ? $str : (sub

10. strrchr() function sometimes returns incorrect results

Introduction: The result returned by the strrchr() function is sometimes wrong? The classic example in the manual: echo strrchr("Hello world!","world"); The output is: world! But if you continue to try, you will find these weird results: echo strrchr("Hello aaaaworld! ","aaaaworld"); Output: aworld!echo s

[Related Q&A recommendations]:

javascript - chr() in php Why can the function output unicode characters?

##c++ - Could you please explain the detailed meaning of strchrnul

The above is the detailed content of 10 recommended articles about the string function chr(). 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