PHP interview questions 03

Source: Internet
Author: User
PHP interview question exam 034. what tools are used for version control? SVN5, how to implement string flip? $ StrHolleWorld !; Echostrrev ($ str );! DlroWelloHechot_strrev ($ str );! DlroWelloHfunctiont_strrev ($ str) {$ n_str PHP interview question exam 03
4. what tools are used for version control?
SVN

5. how to implement string flip?

$ Str = "Holle World! "; Echo strrev ($ str );//! DlroW elloHecho t_strrev ($ str );//! DlroW elloHfunction t_strrev ($ str) {$ n_str = ''; for ($ I = strlen ($ str); $ I >=0; $ I --) {$ n_str. = $ str [$ I];} return $ n_str;} // end func


This is okay, but it should not.

Solution to Chinese garbled text:
/*** Reverse the utf8 string and use the function starting with mb * @ param string $ str * @ return string */function t_strrev ($ str) {$ len = mb_strlen ($ str, 'utf-8'); $ string = ''; for ($ I = $ len-1; $ I> = 0; $ I --) {$ string. = mb_substr ($ str, $ I, 1, 'utf-8');} return $ string;} // end func

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.