Things to do in Cape Town, the Helderberg, and the Cape Winelands

Tag multi-dimension

PHP: Implode a Multi-dimensional Array

PHP’s implode is a pretty handy function to flatten any array into a single string value, using any piece of ‘glue’ (basically a substring) that you specifiy to put everything together. Of course, extending this function to handle multi-dimensional arrays (or matrices if you prefer) is a pretty simple matter of quickly whipping up a recursive version.

© 2021 An Exploring South African — Powered by WordPress