Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,089 questions

40,774 answers

573 users

How to access specific JSON object value using PHP

1 Answer

0 votes
$JSON = '{"Website": [{"url": "https://www.collectivesolver.com/", "title": "Collective Solver"},
                     {"url": "https://www.collectivesolver.com/32116/how-to-split-a-string-in-c", "title": "How to split a string in C - Collective Solver"}]}';

$jsonDecod = json_decode($JSON, true);

$URL = $jsonDecod['Website'][0]['url'];
$title = $jsonDecod['Website'][0]['title'];

echo $URL . "\n";
echo $title . "\n";


$URL = $jsonDecod['Website'][1]['url'];
$title = $jsonDecod['Website'][1]['title'];

echo $URL . "\n";
echo $title . "\n";




/*
run:

https://www.collectivesolver.com/
Collective Solver
https://www.collectivesolver.com/32116/how-to-split-a-string-in-c
How to split a string in C - Collective Solver

*/

 





answered Jun 28, 2020 by avibootz

Related questions

3 answers 115 views
3 answers 121 views
1 answer 68 views
68 views asked Jan 29, 2022 by avibootz
1 answer 66 views
66 views asked Feb 16, 2021 by avibootz
...