PHP: Tags
Why use tags
For the interpreter — the program that executes the code — to perceive it not as plain text, any PHP code must be wrapped in the <?php ?> construct. This is a feature of this programming language.
<?php is the opening tag, and ?> is the closing tag. PHP allows you to omit the closing part ?>. And the PSR-12 code style guide forbids specifying it.
Instructions
Type the code from the example, and put the <?php tag at the beginning:
<?php
print_r('King in the North!');Tips
If you've reached a deadlock it's time to ask your question in the «Discussions». How ask a question correctly:
- Be sure to attach the test output, without it it's almost impossible to figure out what went wrong, even if you show your code. It's complicated for developers to execute code in their heads, but having a mistake before their eyes most probably will be helpful.
Your exercise will be checked with these tests:
<?php
namespace HexletBasics\Basics\Tags;
use HexletBasics\Exercise\TestCase;
class SolutionTest extends TestCase
{
public function test()
{
$expected = 'King in the North!';
$this->assertOutput($expected);
}
}Teacher's solution will be available in:
20:00
