programming-examples/php/Arrays/PHP script which decodes the following JSON string.php

15 lines
275 B
PHP
Raw Normal View History

2019-11-15 12:59:38 +01:00
<?php
function w3rfunction($value,$key)
{
echo "$key : $value"."\n";
}
$a = '{"Title": "The Cuckoos Calling",
"Author": "Robert Galbraith",
"Detail":
{
"Publisher": "Little Brown"
}
}';
$j1 = json_decode($a,true);
array_walk_recursive($j1,"w3rfunction");
?>