PHP String Function questions

Source: Internet
Author: User

CTRL + A View answers

1. What is a function that converts a string of ASCII characters to a hexadecimal value? Answer: Bin2Hex ($string), e.g. Bin2Hex (' ab ') = 6162

What are the functions of the 2.ASCII code-to-character, representable ASCII code? answer: chr (int $ascii), ord (string $string)

3. What is a function that converts a hexadecimal string into a binary string? Answer: Hex2bin ()

4. What is the difference between converting HTML code into a special HTML entity and the opposite function? Answer: Htmlspecialchars (), Htmlspecialchars_decode ()

What is the alias of the function in 5.join? Answer: Implode ()

6. Make the first letter lowercase, the first letter uppercase, all the letters lowercase, all uppercase letters, the first letter of each word is capitalized function? answer Lcfirst (), Ucfirst (), Strtolower (), Strtoupper (), Ucwords ()

7. What is the function that calculates the MD5 hash value of the specified file? Answer: Md5_file ($filename)

8. What is the function of formatting a number in thousands separators? Answer:string number_format ( float $number [, int $decimals = 0])

9. What is a function that parses a string into multiple variables? Answer: Parse_str ($string [, $array])

10. What is the function that repeats a string number? Answer: Str_repeat ($str, $count)

11. What is a function that fills a string with a specified length using another string? str_pad  ( $string  ,  $length  [, $ps  = ""  [,   str_pad_right| Str_pad_left  | Str_pad_both  ])

< Span class= "Methodparam" > 12. What is a function that randomly scrambles a string?

< Span class= "Methodparam" > 13. What is the function of converting a string to an array by a fixed length? array str_split  ( < Span class= "Methodparam" >string  $string  [, < Span class= "Methodparam" >int  $split _length  = 1 ])

14. What are case-sensitive and case-insensitive functions where the first occurrence of a string is found? Answer: Strpos ($haystack, $needle), Stripos ($haystack, $needle)

15. What are case-sensitive and case-insensitive functions where the last occurrence of a string is found? Answer: Strrpos ($haystack, $needle), Strripos ($haystack, $needle)

16. What are case-sensitive and case-insensitive functions for finding the first occurrence of a string? Answer: Strstr ($haystack, $needle), Stristr ($haystack, $needle)

17. What is a function that gets the length of a string? Answer: strstr ()

18. What is the function of calculating the number of occurrences of a string? Answer: Substr_count ($haystack, $needle)

19. What is the function that specifies the starting point to get the contents of a string? Answer: substr ($string, $start [, $length])

What is the difference between the 20.str_replace () and the Substr_replace () function? A: the Str_replace () function is a lookup substitution, and substr_replace () is replaced by length

PHP String Function questions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.