Reputation: 7003
[["pdf-sample.pdf",["uploads\/28\/pdf-sample.pdf"],{"en":"PDF Sample"},"","28"],["pdf-sample2.pdf",["uploads\/29\/pdf-sample2.pdf"],{"en":"Second PDF sample"},"","29"]]
Now I know how to access uploads\28\pdf-sample.pdf
part - just type $value[1][0]
, but I need to get the description of that file, which is PDF Sample
- and how can I access that?
My code thus far:
$files = json_decode($p['file']);
foreach ($files as $value) {
echo $value[1][0].'<br />';
}
Upvotes: 0
Views: 55
Reputation: 8583
You are decoding it as an object so to access the en
value you need to do something like
$files = json_decode('[["pdf-sample.pdf",["uploads\/28\/pdf-sample.pdf"],{"en":"PDF Sample"},"","28"],["pdf-sample2.pdf",["uploads\/29\/pdf-sample2.pdf"],{"en":"Second PDF sample"},"","29"]]');
foreach ($files as $value) {
echo $value[2]->en.'<br />';
}
Upvotes: 1