Arrays -accessing - 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.
Result of php executing
Full code of Arrays -accessing .php
- <?php
- $nutrition = [
- 'fat' => 16,
- 'sugar' => 51,
- 'salt' => 6.3,
- ];
- ?>
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Create & Access Associiative ARRAY</title>
- </head>
- <body>
- <h1>The Candy Store</h1>
- <h2>Nutrition (per100g)</2>
- <p> Fat: <?php echo $nutrition ['fat']; ?>%</p>
- <p> Sugar: <?php echo $nutrition ['sugar']; ?>%</p>
- <p> fat: <?php echo $nutrition ['salt']; ?>%</p>
- </body>
- </html>