SOsample21Nov2021 - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of SOsample21Nov2021.php

  1. <?php
  2. //$json = file_get_contents("./user-data.json");
  3.  
  4. $json='[{
  5. "user":"admin",
  6. "password":"admin"
  7. },
  8. {
  9. "user":"login",
  10. "password":"login"
  11. },
  12. {
  13. "user":"stackoverflow",
  14. "password":"goodpassword"
  15. }
  16. ]';
  17.  
  18. $json_data = json_decode($json, true);
  19.  
  20. foreach ($json_data as $key=>$getdata) {
  21.    echo $getdata["user"] . "-" . $getdata["password"];
  22.    echo "<hr>";
  23. }
  24.     ?>
File Description
  • SOsample21Nov2021
  • PHP Code
  • 21 Nov-2021
  • 386 Bytes
You can Share it: