array test - 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 array test.php

  1. <?php
  2.  
  3. $personas = [
  4.     "persona1" => [
  5.         "name" => "Bob",
  6.         "role" => "vice-president"
  7.     ],
  8.     "persona2" => [
  9.         "name" => "Carol",
  10.         "role" => "president"
  11.     ] 
  12. ];
  13.  
  14. foreach( $personas as $key => $value ){
  15.     echo $key["name"];
  16. }
  17.  
  18.  
File Description
  • array test
  • PHP Code
  • 19 Oct-2018
  • 262 Bytes
You can Share it: