PHP Tutorial String

To Array

  1. Break a string into an array and return an array except for the last -limit elements() in PHP
  2. Break a string into an array and return an array with a maximum of limit element(s) in PHP
  3. Break a string into an array and return only one element in PHP
  4. Break a string into an array in PHP

Compare

  1. Calculate the Levenshtein distance between two strings in PHP
  2. Calculate the metaphone key of " World " : in PHP
  3. Calculate the similarity between two strings and return the matching characters in PHP
  4. Calculate the similarity between two strings in percent: in PHP
  5. Calculate the soundex key of " Hello " in PHP
  6. Check if the password contains only numbers in PHP
  7. Check various return values from strcmp in PHP
  8. Compare Different return values from strcasecmp in PHP
  9. Compare strings with locale information in PHP
  10. Compare two strings (case-insensitive): in PHP
  11. Compare two strings case-sensitive in PHP
  12. Compare two strings in PHP
  13. Compare two strings using a " natural " algorithm (case-insensitive): in PHP
  14. Compare two strings using a " natural " algorithm (case-sensitive) in PHP
  15. Compare two sub strings (case-insensitive) in PHP
  16. Compare two sub strings (case-sensitive) in PHP

Convert

  1. Convert a string from one character-set to another in PHP
  2. Convert all characters to lowercase in PHP
  3. Convert all characters to uppercase in PHP
  4. Convert the decimal values 43 and 61 to add the ASCII Characters: + and = in PHP
  5. Convert the first character of " Hello " to lowercase in PHP
  6. Convert the first character of each word to uppercase in PHP
  7. Convert the first character of " hello " to uppercase in PHP
  8. Convert the octal value 046 to add the ASCII Character in PHP
  9. Create an array where key is word position in the string, and value is the actual word in PHP
  10. Create an array with the words from the string in PHP

Count

  1. Count char frequency in PHP
  2. Count the number of times " world " occurs in the string in PHP
  3. Count the number of words found in the string " Hello World! " in PHP

Encode Decode

  1. Decode a quoted-printable string to an 8-bit ASCII string in PHP
  2. Decode a uuencoded string: in PHP
  3. Decode data encoded with MIME base64 in PHP
  4. Encode a string and then decode it in PHP
  5. Encode a string and then decode it using the uuencode algorithm in PHP
  6. Encode a string using the uuencode algorithm in PHP
  7. Encode and decode a string in PHP
  8. Encode data with MIME base64 in PHP

Format

  1. Display dot if the string is too long in PHP
  2. Format value to a string with sprintf in PHP

HereDoc

  1. Embed variable in hereDoc and string in PHP
  2. Print out heredoc in PHP

Pad

  1. Emulate str_pad() with while loop and strlen function in PHP
  2. Pad string from both side in PHP
  3. Pad to both sides of the string: in PHP
  4. Pad to the left side of the string: in PHP
  5. Pad to the right side of the string, to a new length of 20 characters in PHP
  1. Find the first occurrence of " world " inside " Hello world! " and return the rest of the string in PHP
  2. Find the first occurrence of " world " inside " Hello world! " case-insensitive, and return the rest of the string in PHP
  3. Find the position of the first occurrence of " CSS " inside the case-insensitive string in PHP
  4. Find the position of the first occurrence of " CSS " inside the string in PHP
  5. Find the position of the last occurrence of " CSS " inside the string in PHP
  6. Match a filename or string against the specified pattern in PHP
  7. Search a string, and return all characters from this position to the end of the string in PHP
  8. Search a string for ASCII value of " e " (101) and return all characters from this position to string end in PHP
  9. Search a string for the ASCII value of " o " and return the rest of the string: in PHP
  10. Search a string for the ASCII value of " o " case-insensitive, and return the rest of the string in PHP
  11. Search a string for the characters, return the rest of the string in PHP
  12. Search for a specified character or text within a string in PHP

Operation

  1. Get information about characters used in a string in PHP
  2. Get the part of the string before the first occurence of " world " in PHP
  3. Print the number of characters found in " Hello world! " before the character " w " in PHP
  4. Randomly shuffle all characters of a string in PHP
  5. Reference a single character from a string in PHP
  6. Return characters from different ASCII values in PHP
  7. Return the ASCII value of " h " in PHP
  8. Return the number of characters found in the string " Hello world! " that contains the characters " kHlleo " in PHP
  9. Return the part of the string before the first occurence of " world " Case-insensitive in PHP
  10. Tokenize a string by :,| in PHP
  11. Use while loop to control the strpos in PHP
  12. Using all parameters: in PHP
  13. Wrap a string into new lines in PHP

Substring

  1. Get sub from the string start in PHP
  2. Get value from a line using strpos and substr in PHP

Length

  1. Get the length of a string, in characters in PHP
  2. Return the length of the string " Hello " : in PHP
  3. Use the length parameter on metaphone function in PHP
  4. Using the length parameter: in PHP
  5. Wrap a string into new lines when it reaches a specific length in PHP

Insert

  1. Insert " Hello " at the beginning of " world " in PHP
  2. Insert line breaks where newlines (\n) occur in the string in PHP
  3. Insert line breaks where newlines (\n) occur, using the xhtml parameter in PHP

Remove

  1. Remove characters from both sides of a string in PHP
  2. Remove characters from the left side of a string in PHP
  3. Remove characters from the right end of a string in PHP
  4. Remove newlines (\n) from both sides of the string in PHP
  5. Remove newlines (\n) from the left side of a string in PHP
  6. Remove newlines (\n) from the right end of a string in PHP
  7. Remove whitespaces from both sides of a string in PHP
  8. Remove whitespaces from the left side of a string in PHP
  9. Remove whitespaces from the right side of a string in PHP

Repeat

  1. Repeat the string a number of times in PHP

Replace

  1. Replace " Hello " with " world " : in PHP
  2. Replace at the 5th position from the end of the string in PHP
  3. Replace at the 6th position in the string in PHP
  4. Replace multiple strings at once. Replace " AAA " in each string with " BBB " in PHP
  5. Replace the characters " WORLD " (case-insensitive) in the string " Hello world! " with " XML " in PHP
  6. Replace the characters " ia " in the string with " eo " in PHP
  7. Replace the characters " world " in the string " Hello world! " in PHP
  8. Replace the string with value in associative array in PHP
  9. Use str_replace() with an array and a count variable in PHP
  10. Use str_replace() with less elements in replace than find in PHP

Reverse

  1. Reverse the string " Hello World! " in PHP

Sort

  1. Sort with natural algorithm (strnatcmp) and computer string sorting algorithms (strcmp) in PHP
  2. Sort with natural algorithm (strnatcmp) and default sorting algorithms (strcmp) in PHP

Split

  1. Split string one by one in PHP
  2. Split the string " Hello " into an array in PHP
  3. Split the string after each character and add a " . " after each split in PHP
  4. Split the string after each sixth character and add a " ### " after each split in PHP

Strip

  1. Strip the string from HTML tags, but allow bold tags in PHP
  2. Strip the string from HTML tags in PHP




















Home »
  PHP Tutorial »
    Data Types »




Array
Array Associative
Array Util
ArrayObject
Data Types
Date
Date Format
DateTime
Number
String
String Escape
String Filter
String HTML
String Type
Timezone