Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how i can Convert $_POST in a array?

Tags:

post

php

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.


1 Answers

You could do

$a = json_decode($_POST['selected_friends'], true);
like image 54
Nicola Peluchetti Avatar answered Nov 21 '25 16:11

Nicola Peluchetti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!