Level 29
function A () {
$a = 1;
$b = 2;
return compact('a','b');
}
// php
function b () {
$data = A();
$a = $data['a']; // and so on
}
// jquery (assuming its finally sent and parsed as json)
var a = data.a;
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
When you pass data from one page to another using the php compact() function it formats the data as an array.
How do you access that array data from the second page and jquery?
Please or to participate in this conversation.