Related Content
Directory Iteration With DirectoryIterator() In PHP 5
The normal way of looping through a directory is to get a handle on the directory, then go through each item, making sure that the file is readable and is not "." or ".." before doing something with the file. Because this is done a lot the DirectoryIterator() object was created in PHP5 to simplify this process.
Regular Expression To Find Single Apersands In Text
Encoding special characters in a block of HTML or other code can be a pain because there might already be ampersands there that impart encoding. This might be an ampersand that has already been encoded with a &, or it might be an ampersand in the code as an if statement or similar.
Common Regular Expressions
Here are some of the regular expressions that I frequently use.
Find a blank line
^$
Spaces
[ \t]+
You can use this to break a text string apart into words.
Date
reWork: A Regular Expression Workbench
Regular expressions are a very useful tool for any programmer wanting to validate input, format strings, change words, reformat data or even split apart a string into an array.
Add new comment