PHP Strings

Learn how to create and manipulate PHP strings, and how to use common PHP string functions.

Articles in PHP Strings

Formatting Numbers with PHP's number_format() Function - Intermediate Tutorial 29 January 2010

Learn how to use number_format() to display numbers to the user in an easy-to-read format, including thousands separators.

Wrapping Text with PHP's wordwrap() Function - Intermediate Tutorial 19 January 2010

Learn how to use PHP's wordwrap() function to wrap lines of text. Lots of examples included.

Padding PHP Strings with str_pad() - Beginner Tutorial 3 December 2009

Shows how to use PHP's str_pad() function to add padding to strings. Learn how to use custom padding characters, and how to pad a string on the right, left, or both sides.

Trimming PHP Strings - Beginner Tutorial 26 November 2009

Explains PHP's trim(), ltrim() and rtrim() functions for removing unwanted characters from the beginning and/or end of a string.

Formatting PHP Strings with printf and sprintf - Advanced Tutorial 19 November 2009

Learn how to use PHP's printf(), sprintf() and related functions to format strings. Looks at type specifiers, padding, number precision, and more.

Converting PHP Strings between Upper and Lowercase - Intermediate Tutorial 29 October 2009

Learn how to use PHP to convert text between uppercase and lowercase. Looks at strtolower(), strtoupper(), lcfirst(), ucfirst(), ucwords(), and more.

Replacing Text in PHP Strings - Intermediate Tutorial 19 October 2009

Explains how to replace chunks of text inside PHP strings using str_replace() and substr_replace(). Also looks at deleting and inserting text.

Searching Strings in PHP - Intermediate Tutorial 13 October 2009

Learn how to search through strings of text in PHP. Looks at strstr() for simple searching; strpos() and strrpos() for locating text; and substr_count() for counting matches.

Basic PHP String Operations - Beginner Tutorial 28 September 2009

Explains some basic concepts of PHP strings. Find out how to join strings together, get the length of a string, and access characters within a string.

Creating Strings in PHP - Beginner Tutorial 14 September 2009

Learn how to create strings in PHP. Looks at single and double quoted strings; variable parsing; escape sequences; multi-line strings; heredoc/nowdoc syntax, and more.

Follow Elated