PHP String Programs Last Updated : 26 Oct, 2023 Comments Improve Suggest changes Like Article Like Report Strings can be seen as a stream of characters. For example, ‘G’ is a character, and ‘GeeksforGeeks’ is a string. This article contains a list of all programming articles based on String in PHP that are majorly asked in Interviews. S. No. Articles 1PHP Program to Read Each Character of a String 2PHP Program to Check for Substring in a String3PHP Program to Replace String4PHP Program to Get the Last Character of a String 5PHP Program to Get the Position of a Character in a String 6PHP Program to Insert a Line Break in a String7PHP Program to Check if a String Contains a Substring8PHP Program to Get the Last n Characters of a String9PHP Program to Check a String is a Rotation of Another String10PHP Program to Limit String Length11PHP Program to Replace a Word Inside a String12PHP Program to Check for Empty String13PHP Program to Prepend a String14PHP Program to Get a Substring Between Two Strings15PHP Program to Write Multi-Line Strings16PHP Program to Get the First Word of a Sentence17PHP Program to Convert Array to String18PHP Program to Extract Numbers From a String19PHP Program to Get Different Characters in the Given String20PHP Program to Find Number of Characters in a String 21PHP Program to Insert String at Specified Position22PHP Program to Encrypt and Decrypt a String23PHP Program to Concatenation of Two Strings24PHP Program to Put String in Array and Split by New Line 25PHP Program to Change Strings in an Array to Uppercase26PHP Program to Remove Special Character from String 27PHP Program to Remove All Non-Printable Characters in a String 28PHP Program to Generating Random String 29PHP Program to Print All Permutations of a Given String30PHP Program to Repeat a String to a Specific Number of Times 31PHP Program to Replace Multiple Characters in a String 32PHP Program to Remove the First Character of a String 33PHP Program to Find the Length of the Last Word in a String34PHP Program to Generate a Random, Unique, Alphanumeric String35PHP Program to Get String Length 36PHP Program to Find Minimum Rotations that Required to Get the Same String37PHP Program to Remove Line Breaks from the String 38PHP Program to Convert a String into Number 39PHP Program to Extract Numbers from String 40PHP Program to Convert Uppercase String to Lowercase 41PHP Program to Convert an Integer Into a String42PHP Program to String Comparison using == vs strcmp() Function 43PHP Program to Sort Array of Strings in Natural and Standard Orders44PHP Program to Print All the Values of an Array 45PHP Program to Create Comma Separated List from an Array 46PHP Program to Check for Empty String 47PHP Program to Append a String 48PHP Program to Remove All White Spaces from a String 49PHP Program to Converting String to Date and DateTime50PHP Program to Count the Number of Words in a String51PHP Program to Convert String to Boolean 52PHP Program to Get a Variable Name as a String 53PHP Program to Convert DateTime to String 54PHP Program to Remove New Lines from String 55PHP Program to Get String Between Two Characters 56PHP Program to Remove White Spaces from Beginning/End of a String57PHP Program to Check if All Characters are Lowercase58PHP Program to Removing Occurrences of a Specific Character from End of a String59PHP Program to Convert Lowercase String to Uppercase 60PHP Program to Convert First Character of All Words Uppercase61PHP Program to Find the Number of Sub-string Occurrences62PHP Program to Create a String by Joining the Array Elements Comment More infoAdvertise with us Next Article PHP String Programs H hardiksm73 Follow Improve Article Tags : PHP PHP-string Similar Reads How to run PHP programs ? PHP (Hypertext Preprocessor) is a popular server-side scripting language primarily used for web development. It is designed to generate dynamic web pages and interact with databases. Running PHP programs involves setting up a development environment, whether locally or on a live server. In this arti 2 min read Output of PHP programs | Set 3 Predict the output of below PHP programs: Question 1 PHP <?php $number = array(0, 1, one, two, three, 5); $num = preg_grep("/[0-5]/", $number); print_r($num); ?> Options: Array([0]=>0 [1]=>1 [2]=>one [3]=>two [4]=>three [5]=>5) Array([2]=>one [3]=>two [4]=> 3 min read PHP strtok() for tokening string Like C strtok(), PHP strtok() is used to tokenize a string into smaller parts on the basis of given delimiters It takes input String as a argument along with delimiters (as second argument). Syntax : string strtok ( string $string, string $delimiters ) Parameters :This function accepts two parameter 2 min read PHP Versions PHP has been a key technology in web development from the beginning, helping create interactive websites and web applications. Over the years, PHP has evolved, introducing new features, performance improvements, and better security. Understanding the different PHP versions and their changes is essen 3 min read PHP | Sessions A session in PHP is a mechanism that allows data to be stored and accessed across multiple pages on a website. When a user visits a website, PHP creates a unique session ID for that user. This session ID is then stored as a cookie in the user's browser (by default) or passed via the URL. The session 7 min read PHP String Functions Strings are a fundamental data type in PHP, used to store and manipulate text. PHP provides a wide variety of built-in string functions. These functions perform various operations such as string transformations, character manipulations, encoding and decoding, and formatting, making string handling s 6 min read Top PHP Projects with Source Code The term PHP is an acronym for â Hypertext Preprocessor. PHP is a server-side scripting language designed specifically for web development. It is open-source which means it is free to download and use. It is very simple to learn and use. The file extension of PHP is â.phpâ. PHP was introduced by Ras 3 min read PHP Tutorial PHP is a widely used, open-source server-side scripting language primarily designed for web development. It is embedded directly into HTML and generates dynamic content on web pages, making it essential for building data-driven websites. It allows developers to handle database interactions, session 9 min read Output of PHP programs | Set 1 (Regular Expressions) Predict the output of following PHP programs: Question 1 PHP <?php echo str_pad("Welcome", 5)." to GeeksforGeeks."; ?> Options: WelcomeWelcomeWelcomeWelcomeWelcome to GeeksforGeeks. to GeeksforGeeks. WelcomeWelcomeWelcomeWelcomeWelcome to GeeksforGeeks. Welcome Welcome to G 3 min read Like