Easy To Learning
  • Login
  • Sign Up
  • Q&A
  • Home
  • Php Tutorial
  • MySql Tutorial
  • Object-Oriented Programming
  • Java Tutorial
  • HTML Tutorial
  • React JS Tutorials
  • Free Projects
  • Blogs & Articles
  • Others
    • About Us
    • Contact Us
PHP String Functions
Easy To Learning

Education Needs Complete Solution

Online Ask Question Question And Answer
  1. Home
  2. PHP Tutorials
  3. PHP String Functions

PHP Tutorial

Basic PHP Fundamentals

  • PHP Tutorial Content
  • PHP Introduction
  • PHP History
  • Uses of PHP
  • PHP Features
  • What Is PHP
  • PHP Installation And Software Requirements
  • How To Install Wamp Server
  • How To Install Xampp Server
  • Php Syntax
  • PHP Variables
  • PHP Data Types
  • PHP Constants
  • PHP Echo And Print
  • PHP Operators
  • PHP Assignment Operators
  • PHP String And Logical Operators
  • Operators Categories
  • PHP Comments
  • PHP $ And $$ Variables
  • Super Global Variables

PHP Control Statement

  • PHP Control Structure
  • PHP If Statement
  • If Elseif Statement In PHP
  • Switch Statement In PHP
  • Break Statement In PHP
  • If Elseif Else Statement
  • Continue Statement In PHP

Php Loops

  • What Is Loop
  • For Loop In PHP
  • PHP Foreach Loop
  • PHP While Loop
  • Do While Loop

PHP Arrays

  • PHP Arrays
  • Indexed Arrays
  • Associative Array
  • Multidimensional Arrays
  • Array Functions
  • Array Constants
  • List of Array Functions
  • Array Functions First Exercise

Php String

  • String In PHP
  • PHP String Functions

PHP Functions

  • PHP Functions
  • PHP Parameterized Function
  • PHP Call By Value
  • Call By Reference In PHP
  • Default Argument Values Function In PHP
  • Variable Argument Function In PHP
  • Recursive Function In PHP
  • Math Function In PHP
  • Math Function Examples

PHP Form

  • Form Handling In PHP

PHP Include

  • Include File In PHP

PHP State Management

  • Cookies In PHP
  • Session In PHP

PHP File System

  • File Handling In PHP
  • Open Files In PHP
  • Read Files In PHP
  • Write Files In PHP
  • Delete Files In PHP
  • Append To Files In PHP

PHP Upload & Download

  • File Upload In PHP
  • Download File In PHP

PHP Mail System

  • Mail System In PHP
  • Mail With Attachment In PHP

Basic PHP Program

  • Php Programs
  • Sum Of Digits
  • PHP Even Odd Program
  • Prime Number Program
  • Table Of Number Program
  • Factorial Of A Number
  • Armstrong Number
  • Palindrome Number
  • Fibonacci Series

PHP String Functions

PHP String Functions / Manipulating PHP Strings

The following string functions are the part of the PHP core so you can use these functions within your script without any further installation.

string function

PHP provides many built-in functions for manipulating strings like calculating the length of a string, find substrings or characters, replacing part of a string with different characters, take a string apart, and many others

Function Description
ucfirst() Converts the first character of a string to uppercase
ucwords() Converts the first character of each word in a string to uppercase
trim() Removes whitespace (or other characters) from the beginning and end of a string
strlen() Returns the length of a string
str_repeat() Repeats a string a specified number of times
str_replace() Replace all occurrences of the search string with the replacement string (case-sensitive)
str_shuffle() Randomly shuffles all characters in a string
str_split() Splits a string into an array
str_word_count() Counts the number of words in a string
strpos() Find the position of the first occurrence of a substring in a string
strcasecmp() Binary safe comparison of two string (case-insensitive)
strchr() Finds the first occurrence of a string inside another string. Alias of strstr()
str_rot13() Performs the ROT13 encoding on a string
strcmp() Binary safe comparison of two string (case sensitive)
strnatcasecmp() Compares two strings using a "natural order" algorithm (case-insensitive)
strnatcmp() Compares two strings using a "natural order" algorithm (case-sensitive)
strncasecmp() Binary safe string comparison of the first n characters (case-insensitive)
strncmp() Binary safe string comparison of the first n characters (case-sensitive)
strpbrk() Searches a string for any of a set of characters
strrchr() Find the last occurrence of a character in a string
strrev() Reverses a string
strtolower() Converts a string to lowercase
strtoupper() Converts a string to uppercase
strtr() Translate characters or replace substrings
substr() Return a part of a string
substr_compare() Compares of two strings from a specified start position up to the length of the comparison. The comparison is binary safe and optionally case-sensitive
addcslashes() Returns a string with backslashes before the specified characters
addslashes() Returns a string with backslashes before the characters that need to be escaped. These characters are single quote ('), double quote ("), backslash () and NULL
echo() Output one or more strings
explode() Split a string into an array by a specified string
html_entity_decode() Convert all HTML entities to their applicable characters
htmlentities() Convert all applicable characters to HTML entities
htmlspecialchars_decode() Convert special HTML entities back to characters
htmlspecialchars() Convert special characters to HTML entities
implode() Return a string by joining the elements of an array with a specified string
bin2hex() Convert binary data into hexadecimal values
chop() Strip whitespace (or other characters) from the end of a string. Alias of rtrim()
chr() Returns a one-character string containing the character specified by ASCII
chunk_split() Split a string into smaller chunks
convert_cyr_string() Converts a string from one Cyrillic character set to another
convert_uudecode() Decodes a uuencoded string
convert_uuencode() Encodes a string using the uuencode algorithm
count_chars() Return information about characters used in a string
crc32() Calculates the crc32 polynomial of a string
crypt() One-way string encryption (or hashing)
fprintf() Write a formatted string to a specified output stream
get_html_translation_table() Returns the translation table used by htmlspecialchars()and htmlentities()
hebrev() Convert logical Hebrew text to visual text
hebrevc() Convert logical Hebrew text to visual text with newline conversion
hex2bin() Decodes a hexadecimally encoded binary string
join() Alias of implode()
lcfirst() Converts the first character of a string to lowercase
levenshtein() Calculate Levenshtein distance between two strings
localeconv() Returns localized numeric and monetary formatting information
ltrim() Removes whitespace (or other characters) from the beginning of a string
md5() Calculate the md5 hash of a string
md5_file() Calculates the md5 hash of a file
metaphone() Calculate the metaphone key of a string
money_format() Formats a number as a currency string
nl_langinfo() Returns specific local information
nl2br() Inserts HTML line breaks before all newlines in a string
number_format() Format a number with grouped thousands
ord() Returns the ASCII value of the first character of a string
parse_str() Parses the string into variables
print() Output a string
printf() Output a formatted string
quoted_printable_decode() Convert a quoted-printable string to an 8 bit string
quoted_printable_encode() Convert a 8 bit string to a quoted-printable string
quotemeta() Quotes meta characters
rtrim() Removes whitespace (or other characters) from the end of a string
setlocale() Set locale information
sha1() Calculate the sha1 hash of a string
sha1_file() Calculate the sha1 hash of a file
similar_text() Calculate the similarity between two strings
soundex() Calculate the soundex key of a string
sprintf() Return a formatted string
sscanf() Parses input from a string according to a format
str_getcsv() Parse a CSV string into an array
str_ireplace() Replace all occurrences of the search string with the replacement string. Case-insensitive version of str_replace().
str_pad() Pad a string to a certain length with another string
strcoll() Locale based comparison of two string (case sensitive)
strcspn() Returns the number of characters found in a string before any part of some specified characters are found
strip_tags() Strip HTML and PHP tags from a string
stripcslashes() Un-quotes a string quoted with addcslashes()
stripos() Find the position of the first occurrence of a case-insensitive substring in a string
stripslashes() Un-quotes a quoted string
stristr() Finds the first occurrence of a string inside another string (case-insensitive). Case-insensitive version of strstr()
strripos() Find the position of the last occurrence of a string inside another string (case-insensitive)
strrpos() Find the position of the last occurrence of a string inside another string (case-sensitive)
strspn() Returns the number of characters found in a string that contains only characters from a specified charlist
strstr() Find the first occurrence of a string inside another string (case-sensitive)
strtok() Splits a string into smaller strings
substr_count() Counts the number of times a substring occurs in a string
substr_replace() Replaces a part of a string with another string
vfprintf() Write a formatted string to a specified output stream
vprintf() Output a formatted string
vsprintf() Return a formatted string
wordwrap() Wraps a string to a given number of characters
Series: PHP Tutorials Hub
All Topics
Free Download Projects
Previous Chapter
Next Chapter

Ask a Question

Have a coding query or doubt? Ask here and get help from our community.

500 characters remaining
Submitting...
Free Download Projects
Join Telegram Group Join WhatsApp Group
Related Topics:
Php String Functions Manipulating PHP Strings String Concatenation Operator strlen() function strtolower() function strtoupper() function ucfirst() function ucwords() function

Member Sign In

Forgot?
Signing in...

Don't have an account? Register here

Create Free Account

Register Captcha
Registering...

Already have an account? Sign In

Ask a Question

500 characters remaining
Submitting...

About Easy To Learning

Easy To Learning is a comprehensive programming learning portal offering free, practical, developer-driven tutorials for PHP, Java, Python, Spring, MySQL, CSS, Bootstrap, CakePHP, and more.

Explore community-contributed questions and answers, and download ready-to-run source code projects.

Quick Links

  • Home
  • Questions & Answers
  • Download Projects
  • Blog & Articles
  • Member Login

Community

  • Telegram Group
  • WhatsApp Community
  • Ask a Question
  • Join as Member

Connect With Us

Stay updated with our newest programming tutorials and free open source projects.

© 2026 Easy To Learning. All Rights Reserved.