PHP converts lowercase to uppercase and lowercase, and converts lowercase to uppercase.

Source: Internet
Author: User

PHP converts lowercase to uppercase and lowercase, and converts lowercase to uppercase.

The following code demonstrates how php converts the case sensitivity of RMB. The Code is as follows:

<? Php header ("charset = UTF-8;"); function numTrmb ($ num) {$ d = array ("zero", "one", "two", "three ", "Si", "Wu", "Lu", "Jun"); $ e = array ('meta', 'pick ', 'taobao', 'taobao', 'wan ', 'wan Wan', '100 billion ', 'Yao yi ', ''); $ p = array ('shard', 'angular'); $ zheng = "whole"; $ final = array (); $ inwan = 0; // whether there are tens of thousands of $ inyi = 0; // whether there are hundreds of millions of $ len = 0; // The length after the decimal point $ y = 0; $ num = round ($ num, 2); // accurate to minute if (strlen ($ num)> 15) {return "too large"; die () ;}if ($ c = strpos ($ Num ,'. ') {// indicates the number of decimal places. $ c indicates the number of digits before the decimal point. $ len = strlen ($ num)-strpos ($ num ,'. ')-1; // number of digits after the decimal point} else {// no decimal point $ c = strlen ($ num); $ zheng = 'Integral ';} for ($ I = 0; $ I <$ c; $ I ++) {$ bit_num = substr ($ num, $ I, 1); if ($ bit_num! = 0 | substr ($ num, $ I + 1, 1 )! = 0) {@ $ low = $ low. $ d [$ bit_num];} if ($ bit_num | $ I = $ c-1) {@ $ low = $ low. $ e [$ c-$ I-1] ;}} if ($ len! = 1) {for ($ j = $ len; $ j >=1; $ j --) {$ point_num = substr ($ num, strlen ($ num)-$ j, 1); @ $ low = $ low. $ d [$ point_num]. $ p [$ j-1] ;}} else {$ point_num = substr ($ num, strlen ($ num)-$ len, 1); $ low = $ low. $ d [$ point_num]. $ p [$ len] ;}$ chinses = str_split ($ low, 3); // convert a string to an array for ($ x = count ($ chinses)-1; $ x> = 0; $ x --) {if ($ inwan = 0 & $ chinses [$ x] = $ e [4]) {// filter repeated tens of thousands of $ final [$ y ++] = $ chinses [$ x]; $ in Wan = 1;} if ($ inyi = 0 & $ chinses [$ x] = $ e [8]) {// filter hundreds of millions of repeated final [$ y ++] = $ chinses [$ x]; $ inyi = 1; $ inwan = 0 ;} if ($ chinses [$ x]! = $ E [4] & $ chinses [$ x]! ==$ E [8]) {$ final [$ y ++] = $ chinses [$ x] ;}$ newstr = (array_reverse ($ final )); $ nstr = join ($ newstr); if (substr ($ num,-2, 1) = '0') & (substr ($ num,-1) <> 0) {$ nstr = substr ($ nstr, 0, (strlen ($ nstr)-6 )). '0 '. substr ($ nstr,-6, 6);} $ nstr = (strpos ($ nstr, 'zero angular '))? Substr_replace ($ nstr, "", strpos ($ nstr, '0 angular '), 6): $ nstr; return $ nstr = (substr ($ nstr,-3, 3) = 'meta ')? $ Nstr. $ zheng: $ nstr;} echo numTrmb (965002.65 );

:

Next let's take a look at the php case conversion function.

1. Convert string to lowercase

Strtolower (): This function converts all characters of the input string parameter to lowercase, and puts it back in a small form.

Example:

<?php $str = "I want To FLY"; $str = strtolower($str); echo $str;?>

Output result:

i want to fly

2. Convert characters into uppercase letters

Strtoupper (): this function is opposite to the strtolower function. It is used to convert all the characters of the passed character parameter to a large one.

Write, and return this string in uppercase. The usage is the same as that of strtolowe.

3. Convert the first character of the string to uppercase.

Usfilst (): This function is used to change the first character of a string to uppercase. This function returns the first character of a string in uppercase.

The usage is the same as that of strtolowe.

4. Convert the first character of each word in the string to uppercase.

Ucwords (): This function converts the first character of each word in the input string to uppercase. For example, "hello world ".

After processing, "Hello Word" will be returned. The usage is the same as that of strtolowe.

Summary

The above section describes how to convert the lowercase letters of RMB into uppercase and lowercase letters in PHP and how to convert the uppercase and lowercase letters in PHP. I hope this will be helpful to you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!

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.