I have URL like this, how we recive the value like "abc.org/result.php?rq=[1,2,3,4]&rq1=[5]
" etc
Can any one help me to convert rq into array
when recive the value in result.php
You can try using explode()
& array_map()
$rq = $_GET['rq'];
$arr = array_map(function($v){ return trim($v, ' []');}, explode(',', $rq));
print '<pre>';
print_r($arr);
print '</pre>';
You can use json_decode
to convert into array
$a = json_decode($_GET['rq']);
print_r($a);//Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 )
You can use get request also:
Abc.com?req[]=1&req[]=2
$_GET['req']
Return
(1,2)