Maybe this question is really simple but I can't find any answers on internet and I'm a PHP noob.
how can I print this:
[{"1":{"key":"Aansturing","value":"AAN\/UIT"}},{"1":{"key":"Maximale output","value":"6 W"}},{"1":{"key":"Product categorie","value":"Selecteerbare I OUT"}},{"1":{"key":"Output stroom","value":"350 mA \/ 700 mA"}}]
In
<?php
$jsonString = '[{"1":{"key":"Aansturing","value":"AAN\/UIT"}},{"1":{"key":"Maximale output","value":"6 W"}},{"1":{"key":"Product categorie","value":"Selecteerbare I OUT"}},{"1":{"key":"Output stroom","value":"350 mA \/ 700 mA"}}]';
$jsonData = json_decode($jsonString, TRUE);
?>
<table border>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<?php foreach ($jsonData as $oneRowData): ?>
<?php foreach ($oneRowData as $oneRow): ?>
<tr>
<td><?php echo $oneRow['key'] ?></td>
<td><?php echo $oneRow['value'] ?></td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</table>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments