Skip to content

Instantly share code, notes, and snippets.

@jeffkolez
jeffkolez / flatten_array.php
Last active March 26, 2019 21:15
Write some code, that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
<?php
/**
* flattens an array of arbitrarily nested arrays of integers into a flat array of integers
* it has the side-effect of removing non-integers from the array
*
* @param $array
* @return array $result
*
*/
### Keybase proof
I hereby claim:
* I am jeffkolez on github.
* I am jeffkolez (https://keybase.io/jeffkolez) on keybase.
* I have a public key whose fingerprint is B2EA EA5B 4C58 519A FB2B A971 95D0 8EDF 3AA4 67BD
To claim this, I am signing this object: