Categories
PHP

Checksum Strings and Files with MD5 and SHA1

How to generate a checksum (hash signature) to encrypt or verify if two copies of a string or file are identical in all respects.

Categories
PHP

Search and Replace Unicode Accents

Many foreign languages, such as Turkish, Spanish, and most other European languages have accented letters. In this tutorial, we’ll replace the accented characters with their relevant characters, for example, é with e.

Categories
PHP

Truncate text to a specific length

In this code snippet, we’ll cut long strings short without truncating the text midword.

Categories
PHP

Cleanup Text by Removing Extra Spaces

In this tutorial, we’ll remove extra spaces between words, and remove spaces from the beginning and end of a string.

Categories
PHP

Validating Email Addresses

How to check whether a string contains a valid email address or not.

Categories
PHP

How to break long paragraphs

The text on a screen is harder to read than in a book but short paragraphs keep the content readable. In this tutorial, I’ll explain how to convert or split a long paragraph into short paragraphs with the help of PHP’s built-in functions

Categories
PHP

Sorting with Foreign Languages

How to sort multibyte string properly with PHP’s sort() function.

Categories
PHP

Emailing Form Data

Sending emails via PHP mail() function.

Categories
PHP

Saving Form Data into a File

Learn how to serialize (and unserialize) the form data in PHP for storing it in a file.

Categories
PHP

Validating Selection Lists

How to create a dropdown list from an array, validate selection lists using the in_array() function and validate multiple lists with array_diff() function.