Home » Php » Question mark equals, doesn't work on php

Question mark equals, doesn't work on php

Posted by: admin July 12, 2020 Leave a comment

Questions:

this is my php code:

<html><body>Hey!: <?= "World";?></body></html>

It just prints “Hey!:” Whats wrong with my code?

How to&Answers:

Short tags (which you’re using here) can be turned on or off depending on the server you’re running the code on. If it’s your server, look in php.ini

Answer:

You need to set short_open_tag to 1

http://php.net/manual/en/ini.core.php

Answer:

Does your file end in .php and will it execute as php on your webserver? add

<?php echo "yes I run php!<br>\n"; ?>

to your file to be sure. View source to see what happened to the php tags. Then maybe switch on short tags as the other answers told you to.