fork download
  1. <?php
  2.  
  3. $responses = array('A=1', 'B=2', 'C=3');
  4.  
  5. foreach ($responses as $response) {
  6. $key = explode("=", $response)[0];
  7. $value= explode("=", $response)[1];
  8.  
  9. if($key != "" && $value != "") {
  10. $data[$key] = $value; // <<<<< "Illegal offset type" error on this line
  11. }
  12. }
  13. ?>
  14. <!-- displaying the results of the query -->
  15. <table>
  16. <?php foreach ($data as $key => $value): ?>
  17. <tr><td><?php echo $key; ?></td><td><?php echo $value; ?></td></tr>
  18. <?php endforeach; ?>
  19. </table>
Success #stdin #stdout 0.02s 25408KB
stdin
Standard input is empty
stdout
<!-- displaying the results of the query -->
<table>
        <tr><td>A</td><td>1</td></tr>
        <tr><td>B</td><td>2</td></tr>
        <tr><td>C</td><td>3</td></tr>
    </table>