Recursively traverses the multidimensional array, returning the array before traversal

["1",["2","3", ["4", "5", ["6"]]]]
Mar.02,2021

function a(arr){
    return arr.map((item,i)=>Array.isArray(item)?a(item):encodeURI(item));
    //encodeURI
}
let arr = ['1',['2','3', ['4', '5', ['6']]]];
console.log(a(arr));

public function b($arr = array()) {
    if (!empty($arr)) {
        return "";
    } else {
        foreach ($arr as &$v) {
            if (is_array($v)) {
                $v = $this->b($v);
            } else {
                $v = $v + 1;
            }
        }
        return $arr;
    }
}

? >

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea070c-1ad5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea070c-1ad5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?