Follow us on Twitter!
Syndicate content
Login - Register - Latests submissions

function

When developping a module, we often use some commonly used PHP functions. As you may not know Drupal provides some overrides for these functions. They are often related to strings, they have the same name as their PHP native equivalent except that they are prefixed with drupal_. Here is a list of PHP functions you should replace with its Drupal equivalent:

  • Replace strlen() with drupal_strlen()
  • Replace strtoupper() with drupal_strtoupper()
  • Replace strtolower() with drupal_strtolower()
  • Replace ucfirst() with drupal_ucfirst()
  • Replace substr() with drupal_substr()
  • Replace eval() with drupal_eval()
  • Replace clone with drupal_clone()

For more on this, you should read includes/unicode.inc and includes/common.inc.