php method to delete lowercase letters in a string: first create a new php file, use the [header()] method to set the encoding format of the page to [utf-8]; then create a new string and use for to traverse string; then use echo to output the processed string; and finally view the result in the browser.
The operating environment of this tutorial: Windows 7 system, PHP version 5.6, DELL G3 computer.
How to delete lowercase letters in strings in php:
1. Create a new php file named test.php to explain how to delete strings in php lowercase letters in .
#2. In the test.php file, use the header() method to set the encoding format of the page to utf-8.
3. In the test.php file, create a string for testing and define an empty variable to save uppercase letters.
4. In the test.php file, use for to traverse the string. In the for loop, use the regular expression "/^[a-z]$/", use preg_match determines whether the character is a lowercase letter. If not, the characters are connected into a new character through ".=".
#5. In the test.php file, use echo to output the processed string.
6. Open the test.php file in the browser and view the results.
Related video recommendations: PHP programming from entry to proficiency
The above is the detailed content of How to remove lowercase letters from string in php. For more information, please follow other related articles on the PHP Chinese website!