I'm trying to interpret an array url param in PHP, but it's interpreted as string instead of an array.
On client side, the url is generated with js: URL:
let url = window.location.href.split('?')[0] //example https://www.test.com
The get parameters are added with:
const params = encodeURIComponent(JSON.stringify(array));
url += "?array="+params;
for an example array of [1010,1020,1030], the final url looks like:
https://www.test.com?array=%5B%221010%22%2C%221020%22%2C%221030%22%5D
On server side (PHP), I'm using $_GET['array'] to get those data, the output looks like:
string(22) "["1010","1020","1030"]"
It is a syntactically correct array, but interpreted as string. I know, I could use some string manipulations to get the array I want, but is there a way, that I can get an array right from scratch?
json_decode?