Categories
Uncategorized

Password Handling In PHP

Storing, securing and validating passwords in PHP has historically been a messy business. PHP now provides functions with sensible defaults and a straightforward workflow to make it easy to look after your users’ credentials.

Categories
Uncategorized

Sorting Arrays Using A Custom Order

PHP comes with several sorting functions that will handle most use cases, however sometimes you need to sort a list of items in some non trivial way. This can often be the case when sorting objects. Say for example you had a list of movies with an associated rating, something like: To sort the list […]

Categories
Uncategorized

3 Essential Tips For Writing PHP Code

1. Turn All Errors On PHP tries to give a lot of leeway when interpreting your code, continuing to run when most other languages would quit. This can be useful for rapid prototyping, but can also hide the causes of errors. To give yourself the best chance of understanding what your code is doing and […]

Categories
Uncategorized

Reading Large Files

file_get_contents is brilliant for working with small files in PHP, but can cause memory problems with large files such as imports. fortunately, PHP has ways of navigating files that allow more control.

Categories
Uncategorized

Variable Variables And Functions In PHP

PHP has some interesting dynamic capabilities around variable and function names. These can save you a few minutes in small scripts, but can cause maintenance headaches in large systems when you’re working with a team.

Categories
Uncategorized

What does “only variables should be passed by reference” mean?

Get rid of those notices in your error log.