Posts relating to
Uncategorized

Toggle Navigational Menus and Submenus Using Pure JavaScript

We had an interesting challenge today, where we needed to create a collapsible, responsive menu and sub-menu, using pure JavaScript. Normally this functionality would be part of a frontend framework, but the client’s site doesn’t use any so, rather than using one solely for this functionality, we decided a clean and efficient way would be […]

Use PHP’s in_array() to compare a variable to multiple values

When comparing a variable with multiple values consider using in_array(), instead of complex if expressions. I love clean, easy-to-read code, which is why I am not a fan of if statements with complex expressions. For example, consider the following snippet, which is checking a variable against several values: if ($test_variable === ‘value1’ || $test_variable === […]