Common functionality for PHP