0
0
PHPprogramming~10 mins

PHP tags and embedding in HTML - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start a PHP block.

PHP
<html>
<body>
<?php
 echo "Hello World!"; 
[1]
</body>
</html>
Drag options to blanks, or click blank then click option'
A</php>
B<?php
C<%
D?>
Attempts:
3 left
💡 Hint
Common Mistakes
Using
Using HTML tags like which don't exist
2fill in blank
medium

Complete the code to embed PHP inside HTML to print a variable.

PHP
<html>
<body>
<?php
 $name = "Alice";
 echo [1];
?>
</body>
</html>
Drag options to blanks, or click blank then click option'
A"Hello, " . $name
B"Hello"
C$name + "Hello"
DHello, $name
Attempts:
3 left
💡 Hint
Common Mistakes
Using + to concatenate strings in PHP
Not using quotes around strings
3fill in blank
hard

Fix the error in the PHP tag to correctly embed PHP in HTML.

PHP
<html>
<body>
[1] echo "Welcome!"; ?>
</body>
</html>
Drag options to blanks, or click blank then click option'
A<?
B<%
C<?php
D<script>
Attempts:
3 left
💡 Hint
Common Mistakes
Using short tags
Using HTML tags like