0

I'm new to PHP. I have a code like this

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>

<p>Lean PHP</p>

<?php setCookie("name", "Bob"); ?>
<?= $_COOKIE['name']; ?>
</body>
</html>

I wrote this code with the intention that it will fail. I wanted to check what kind of error message I get for calling setCookie() after an output. But it doesn't give me any errors and it runs fine. Is my understanding wrong that it should fail when I call setCookie() after an output?

Coder
  • 131
  • 1
  • 3
  • 10

0 Answers0