This might seem obvious, but I have the following recursive function:
public static function dependencies($from_id) {
$core = Core::getInstance();
$query = $core->pdo->prepare("SELECT access_code FROM dependencies WHERE hierarchy=:id");
$query->bindValue(":id",$from_id);
$query->execute();
while($data = $query->fetch()) {
$codes[$data['access_code']] = self::dependencies($data['access_code']);
}
return $codes;
}
The output of this result:
Array
(
[12] =>
[17] => Array
(
[101] =>
[104] =>
)
[18] =>
)
These values will always be unique and would like to transform this result into a single, one-dimensional array. What would be the most efficient way of doing this?
example: $array = array(12,17,101,104,18);