Here is a quick code snippet for flattening a multi-dimensional array using PHP.

This uses the function array_walk_recursive that applies a function to every element of an array. Using this function we can add the value to a new array and return that instance.

function flatten(array $array) {…



The NVM (Node Version Manager) is a script used for installing and managing Node. The macOS users can install NVM using the homebrew.

Use this tutorial to help install NVM on your mac and manage Node.js versions.

First remove the installed node version.

brew uninstall --ignore-dependencies node 
brew uninstall --force node

Next install NVM

brew update brew install nvm

Create a directory for the nvm config

We need to add the environment variables to the bash profile you use such as ~/.zshrc

export NVM_DIR=~/.nvm source $(brew --prefix nvm)/

Reset your shell environment.

Check that nvm is installed.

With NVM installed we can now install node.

nvm instal node # install the latest version 
nvm install 16 # install a specific version of node

Check node version is installed

Originally published at