Tag: PHP

How to parse a sentence in PHP

A sentence can be parsed in many different ways in PHP. A few methods are presented here along with their analysis. Regardless of the language you use for parsing a…

Quick Introduction to JSON

JavaScript Object Notation (JSON) is a lightweight standard for data interchange. It offers several advantages over XML for data interchange such as it can be used for serializing and transmitting…

PHP: How to validate email

Validating email is more difficult than one might think. Recently I found this this code at PHP.net and I feel a need to republish this to emphasize its effectiveness and…

PHP: Array functions

Passing arrays by value and reference The difference between passing by value and passing by reference is that you when pass by value, you are passing a copy of the…

PHP usort explained

The usort function sorts an array by values where the values are sorted by a user-defined function. usort has the following syntax The comparison function takes two arguments and it…

is_dir not working

The is_dir() function in PHP allows users to check whether a file is a directory. It returns true if the file is a directory. However, the addresses provided must be…

PHP: Encrypting and Decrypting

The crypt() function provide one-way encryption. Using one-way encryption is like using a key to lock and unlock something. The key is your password. To encrypt: To decrypt: