Hafiz Afnan Hafiz Afnan - 3 months ago 7
PHP Question

How to split up integer value?

how i can split up integer value like '3452' as 3 4 5 2 and assign each integer to an alphabet like 'B = 3', 'G = 4', 'Q = 5', 'U = 2' as we required and then merge these alphabets like 'BGQU' and return this string and use it outside of function. Please tell me if there is any option.

Answer

Firstly your code is incorrect (see your function has no ()) Try implode() like,

function get_value($split_code) {
    return implode('',$split_code);
}

or just use,

implode($split_code);