php

Using filter_var for boolean environment variables

Submitted by charles on

Someone on my team added the following setting to check whether an environment variable was true or false:

$settings['x_menu_admin_enable'] = strtolower(getenv('X_MENU_ADMIN_ENABLE')) === 'true' ? getenv('X_MENU_ADMIN_ENABLE') : FALSE;

I find that using PHPs filter_var makes this code a bit easier to parse and only calls getenv once:

Quick Drupal setup using Acquia's DAMP stack

Submitted by charles on

Acquia have released an all in one Drupal install which includes Acquia Drupal, Apache, MySQL, PHP, PhpMyAdmin, and an Acquia Drupal Control Panel, to allow users to easily test and play around with Drupal, without having to get into the technical details of installing separate instances of Apache, MySQL, PHP etc.

Check it out here: http://acquia.com/downloads

Charles Tanton - backend Drupal engineer, based in Kommetjie

I'm a backend Drupal engineer with 20 years of experience. I'm currently contracted via Tag1 Consulting, working on a Drupal 11 and PHP 8+ system for a confidential Top 10 Global 500 company. I maintain Entity Inspector, a developer tool for inspecting raw entity data as JSON, and I'm a founding member of the Drupal Johannesburg User Group. This site is my home on the web, a place for my blog, my open-source work, and writing about backend engineering and where AI tools genuinely help in a developer's workflow.