how i can Convert $_POST in a array?

by using

print_r($_POST);

i am getting data something like this

Array ( [selected_friends] => {"0":"699712136","1":"1622040878","2":"100002980112267"})

how i can use it as array and put it into a array variable like

$a[0] = 699712136;
$a[1] = 1622040878;

and so on.

Answers


You could do

$a = json_decode($_POST['selected_friends'], true);

It looks like JSON. Try json_decode()


Need Your Help

What do curly braces in Java mean by themselves?

java syntax scope curly-braces

I have some Java code that uses curly braces in two ways

bash_profile not working as it should

linux path environment-variables

Hi Im running linux angstrom distribution on a remote device, I added .bash_profile and .bashrc to /home/root since they didn't exist and I wrote this in them