Propably you don't have enable short_open_tag in your php.ini on our server
Try this
<li><strong><?php echo $key; ?></strong> <?php echo $feature; ?></li>
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Following along in the php series there's homework about arrays.
When I run the code (that's replicated from the video) it's outputting an empty array, not sure why that's happening? Any idea what im doing wrong?
index.php
<?php
$person = [
'age' => 31,
'height' => 5,
'profession' => 'unkown'
];
require 'index.view.php';
index.view.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<ul>
<?php foreach ($person as $key => $feature) : ?>
<li><strong><?= $key; ?></strong> <?= $feature; ?></li>
<?php endforeach; ?>
</ul>
</body>
</html>
Please or to participate in this conversation.