AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Communication Technology

PHP basics: echo, variables and constants

Week 10 · Unit 3 Creating Site Pages (3), Topic 1 (continued): PHP code in a page, echo and print, comments, variables, quotes and types, constants · 3 lessons
Answers are for parents and teachers.
1
Write a PHP block that stores your favourite book title in a variable and prints: My book is …, using double quotes.
2
What do these print? (a) $x = 2; $x = $x + 3; echo $x; (b) echo gettype("7");
3
Find the three mistakes: <? php $name = "Omar" echo 'Hello $name'; ?>
4
Why is the pass mark of a school better as a constant than as a variable?
5
What would the visitor see if a PHP block contained only a comment?