Categories
PHP

Saving Multiple Values in One Cookie

Learn how to store multiple values (array) in one cookie.

Categories
PHP

Check If Cookies are Allowed or Blocked

This code snippet demonstrates how to test if the cookies are enabled on the client or not.

Categories
PHP

Setting a Cookie with Language Preference

Learn a very basic PHP trick for setting up a cookie for a multilingual website.

Categories
PHP

Escaping Special Characters and Quotes in Cookies

What is the difference between setcookie() and setrawcookie() function?

Categories
PHP

Understanding HTTP Cookies

How to send and retrieve data as part of the HTTP header in the form of a cookie.

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.