
Wikis & learning
Read a first PHP expression
Print the number of lessons left in a short course. Printing an expression lets you see what PHP calculated before you build a page around it.
Print the number of lessons left in a short course. Printing an expression lets you see what PHP calculated before you build a page around it.
How it works
Keep strings in quotes, use a period to join pieces of text and put parentheses around a calculation inside a longer expression.
PHP example
<?php
$planned = 8;
$finished = 3;
echo 'Lessons left: ' . ($planned - $finished);Expected result
Lessons left: 5
Try a variation
Change the number of completed lessons to 8. The text should now end in 0.
Discussion
Sign in to participate.



