php accessing strings as arrays

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.

Get future posts via email

Stay updated with our latest content.

We won't send you spam. Unsubscribe at any time.