Skip to main content
codingCourses
  • HTML
  • CSS
  • JavaScript
  • PHP
  • PHP Tutorial
  • PHP Strings
  • PHP Arrays
  • PHP URL
PHP
  • PHP Tutorial
  • echo vs. print
    Understanding echo and print Statement
  • include vs. require
    Differences and Usage
  • Superglobals
    Simple and Essential Usage Guide
  • Constants
    define() vs. const and Array Constants
  • isset() and empty()
    Concepts, Usage, and Key Differences
  • gettype()
    Get the Data Type of a Variable as a String
  • is_int()
    Check if Integer
  • is_float()
    Check if Float
  • is_numeric()
    Check if Numeric
  • is_string()
    Check if String
  • is_array()
    Check if Array
  • is_bool()
    Check if Boolean
  • is_object()
    Check if Object
  • is_resource()
    Check if Resource
  • is_null()
    Check if NULL
  • preg_replace()
    Replace Text Using Regexes
  • preg_match()
    Check if a String Matches a Regex
  • preg_match_all()
    Find All Matches of a Regex
  • preg_split()
    Split String Using Regexes
  • foreach Loop
    Iterating Over Arrays and Objects
  • Detecting Client Browser Info
    $_SERVER['HTTP_USER_AGENT']
  • Detecting Mobile Devices
    Working with Functions for Mobile Detection
  • Distinguishing Between iOS and Android
    Methods to Check if Running on iOS or Android
PHP Strings
  • String Reference
  • trim()
    Trim Whitespace
  • strpos()
    Find First Substring Index
  • mb_strpos()
    Multibyte-Safe Alternative to strpos()
  • stripos()
    Find First Substring Index (Case-Insensitive)
  • mb_stripos()
    Multibyte-Safe Alternative to stripos()
  • str_contains()
    Check if a String Contains a Substring
  • substr()
    Slice Strings by Position and Length
  • mb_substr()
    Multibyte-Safe Alternative to substr()
  • ctype_digit()
    Check if Only Numeric Character(s)
  • explode()
    Convert a String to an Array
  • str_split()
    Split String by Length
  • str_replace()
    Replace Text in a String
PHP Arrays
  • Array Reference
  • in_array()
    Check if a Value Exists in an Array
  • array_map()
    Ideal for mapping array data to new values
  • array_filter()
    Filter Elements with a Callback
  • array_reduce()
    Reducing an Array to a Single Value
  • array_key_exists()
    Check if a Key Exists in an Array
  • array_keys()
    Get a List of Array Keys
  • array_values()
    Get a List of Array Values
  • array_search()
    Searching for a Value in an Array
  • array_diff()
    Finding Array Differences by Value
  • array_diff_assoc()
    Comparing Array Differences by Key–Value
  • array_intersect()
    Finding Common Values Between Arrays
  • array_intersect_assoc()
    Find Common Elements by Key-Value
  • array_slice()
    Slicing an Array
  • array_shift()
    Remove the First Element from an Array
  • array_merge()
    Merging Arrays
  • array_pop()
    Remove the Last Element from an Array
  • array_unshift()
    Add Elements to the Start of an Array
  • array_push()
    Add Elements to the End of an Array
  • implode()
    Convert an Array to a String
PHP URL
  • PHP URL Reference
  • URL Encoding Functions
    Function Purpose & Features
  • urlencode()
    Encoding a URL Query Parameter Value
  • rawurlencode()
    Safely Encoding URI Components
  • http_build_query()
    Build Query Strings from Arrays or Objects
  • URL Decoding Functions
    Function Purpose & Features
  • urldecode()
    Decoding URLs Encoded with urlencode()
  • rawurldecode()
    Decoding URLs Encoded with rawurlencode()
  • parse_str()
    Parse URL Query Strings into Variables

PHP String Reference

PHP Next

Learn about PHP strings and how to work with them.

PHP String Reference
trim()
Trim Whitespace
The trim() function removes whitespace or characters specified by a parameter from both ends of a string.
strpos()
Find First Substring Index
The strpos() function for strings returns the index of the first occurrence of the specified substring. If the specified substring is not found, it returns false.
mb_strpos()
Multibyte-Safe Alternative to strpos()
The mb_strpos() function searches for the position of a substring in a string. Unlike strpos(), it is multibyte-safe and correctly handles UTF-8 encoded text, including Japanese, Korean, and Chinese characters.
stripos()
Find First Substring Index (Case-Insensitive)
The stripos() function returns the index of the first occurrence of the specified substring within a string. Unlike strpos(), this function performs a case-insensitive search. If the substring is not found, it returns false.
mb_stripos()
Multibyte-Safe Alternative to stripos()
The mb_stripos() function searches for the position of a substring in a string. Unlike stripos(), it is multibyte-safe and correctly handles UTF-8 encoded text, including Japanese, Korean, and Chinese characters.
str_contains()
Check if a String Contains a Substring
The str_contains() function checks if a string contains a specific substring. It returns true if the substring is found, or false otherwise. This function is case-sensitive.
substr()
Slice Strings by Position and Length
The substr() function returns part of a string starting at a specified position and length. Useful for slicing strings and extracting substrings.
mb_substr()
Multibyte-Safe Alternative to substr()
The mb_substr() function slices a string starting from a specified position (offset) and for a specified length, returning the extracted substring while safely handling multibyte characters.
ctype_digit()
Check if Only Numeric Character(s)
The ctype_digit() function checks whether a given string contains only numeric character(s) from 0 to 9. It returns true if every character in the string passed as an argument is a digit; otherwise, it returns false.
explode()
Convert a String to an Array
The explode() function splits a string into an array based on a custom delimiter.
str_split()
Split String by Length
The str_split() function splits a string into an array by a specified length. The elements of the returned array are substrings split to the specified length.
str_replace()
Replace Text in a String
The str_replace() function replaces specific text within a string with new text. It also supports replacing multiple values at once using arrays.
PHP Next

codingCourses offers coding tutorials made for everyone.
All materials and examples are continuously reviewed to prevent errors; however, complete accuracy cannot be guaranteed.
Therefore, please carefully test and review all materials and examples to ensure they are free of errors, bugs, or vulnerabilities before relying on them.
They are available under the Creative Commons Attribution 4.0 International

Copyright © codingCourses. All Rights Reserved.