Bạn đang xem: Split a comma delimited string into an array in php explode() function
2. PHP ltrlặng (): Delete the characters to lớn the left of the string
This function is the opposite of the chop () function, which removes the left quart of the string and notes that only leading characters in the string can be calculated.
3. PHP.. chunk_split (): Split the string inlớn small strings.
Result:Let a variable $ str contain the string: “I am Lam”Print out with echo : gọi chunk_split () function with 3 đầu vào parameters, the first parameter (required) passed to the string variable, the second parameter và the third parameter (optional) is after how much Text is inserted into lớn the content in quotes.
4. PHPhường lcfirst (): Convert the first character lớn lowercase
Result:There’s nothing much to say about this function. Simply pass in a string and which word is in uppercase is pressed inlớn lower case.
5. PHP similar_text (): Count the number of characters that overlap between two strings
Result:And if the two strings are different, the function will return the number of distinct characters in the string.
7. PHPhường strchr (): Find the character in the string, return that character & the rest
Result:The strchr () function will find the character in the string, if found it will return that character & the entire string after the character just found.
8. PHP strcmp (): Compares two strings and is case sensitive
"; // => 0//Phân biệt chữ hoa chữ thường cùng lúc hoán đổi vị trí chuỗiemang đến strcmp("i am lam!","I AM LAM!") . ""; // => 32echo strcmp("I AM LAM!","i am lam!") . ""; // => -32//Giảm độ lâu năm tại 1 chuỗi và khi hoán đổi địa chỉ chuỗiecho strcmp("I am Lam!","I am") . ""; // => 5eđến strcmp("I am","I am Lam!") . ""; // => -5//Tăng độ dài tại 1 chuỗi và lúc hân oán thay đổi địa chỉ chuỗiecho strcmp("I am Lam nhảm","I am Lam") . ""; // => 7eđến strcmp("I am Lam","I am Lam nhảm") . ""; // => -7?>
Result:The strcmp () function is case sensitive, if the second string is lowercase, the result is always -32 & vice versa.In a nutshell, this function returns:0 – if two strings are equal – if string1 is less than string2>0 – if string1 is greater than string2
9. PHP strcspn (): Print the number of characters before the searched character.
Results: 2strcspn () searches for double quotes from the beginning of the string. It only searches once & prints out the number of characters that preceded it.
10. PHP.. stristr (): Print the number of characters after the searched character.
Result:If strcspn () prints the characters before the searched character, stristr () will print the characters after the searched character.
Xem thêm: Chính Thức Đóng Cửa Game Vtc Trúng, Phát Lộc Club 2021, Game Phát Lộc Vtc (Phatlocgamevtc)
11. PHPhường. strlen (): Returns the length of the string
Results: 3The name & the way it works, the strlen () function counts & returns the number of characters in the string.
12. PHP strpbrk (): Search for a string for any specified character
Result:Passing whatever character you want to lớn tìm kiếm for in the string, the strpbrk () function will browse from the beginning of the string, where the first character you want lớn find appears, it will print the characters after the searched character. .
13. PHPhường strrev (): Reverse the string
Results: LamThe index index starts at 0, counts from the beginning of the string to the sixth character L, so the substr () function prints the result Lam .
17. PHP substr_count (): Count the number of times the substring occurs in a given string.
Results: 2Very clear và easy khổng lồ understand, looking at the first string, the substring “Lam” appears 2 times in the parent string => resulting in 2.
18. PHP substr_replace (): Replaces string at a specified index.
Result: Hello LinhAccording to lớn the above code, when counting the index khổng lồ number 6, we replace the substring “Linh” into the parent string, so the word Lam will be lost, replaced by the word Linc.
19. PHPhường tryên (): Delete leading và trailing characters.
Result:The trlặng () function will find the first & last characters & perkhung deletion from those characters, if you enter the characters in the middle, it will accept, it cannot be processed.
20. PHP ucfirst (): converts the first character of a string to uppercase
Result: Hello lamAgain, only the first letter in the string!PHP ucwords (): converts the first character of each word in the string to lớn uppercase
Result: Hello LamEach letter at the beginning of each word will be converted khổng lồ upper case.
Xem thêm: Download Your Free Pdf Download Game: Undercover In The Secret Society Of Pick
2. Reference sources
Refer to lớn PHP string reference .
So many so I can’t remember them all, so stay here and see!
This is how the world"s 3rd largest cryptocurrency by market capitalization can become a "blaông xã swan" of the financial system.July 12, 2021