Correct Changes

To change the character case of PHP, there are built-in functions strtolower and strtoupper. As a rule they are sufficient for everyday tasks of programming with PHP. As is known, the function strtolower strtoupper and convert a string to lower and upper register accordingly. But in the wrong locale settings of these functions give very strange results, which makes puzzle to solve this problem. To avoid this offer to write two functions that will work correctly in all cases and will help avoid many misunderstandings. Let's start. To achieve the result we use the function strtr (). Let me remind you that this function returns a string in which every occurrence of any characters listed in the first parameter is replaced by the corresponding character from the string passed as the second parameter.

So our task is to replace the alphabet in upper case alphabet in lower case to convert all characters to lowercase. Conversely, the alphabet in lower case alphabet is replaced in upper case, to translate characters to uppercase. Let's look at the source code for both functions: The function converts povsedrenvy work of the programmer. Enough to include them in its library and call when it is needed. Now, the local can be configured as desired, and the characters will be converted to upper and lower case, as it expected. Agree that these features increase the chance of safely move the website to another hosting service.