php accessing strings as arrays

Ian Landsman • November 26, 2004

A tip that relates to below. I find that developers often forget that you can access strings as arrays. This comes in handy for finding a specific character in a specific point in a string. For example, when looping over a list of files using:


if($filename{0} != '.'){
.... not a hidden file
}

                    <br /> Will keep you from getting a bunch of hidden files or the '.' && '..' directories. Make sure to note that you have to use curly brackets and not square brackets.