Sonzaschool
Back

O-Level · Form 2 · Vocational · Electronics and Computer

Computer Programming

Applying basic PHP syntax

about 3 minutes to read

Discussions
Topics in this sectionCreating PHP programs4 topics

PHP is a server-side scripting language used to create dynamic web pages. In this topic, you will learn the basic syntax rules for writing PHP code, including how to use tags, statements, variables, and how to embed PHP into HTML.

Every PHP script must begin with an opening tag and end with a closing tag. These tags tell the web server that the code between them should be processed as PHP.

<?php
// PHP code goes here
?>
  • The opening tag is <?php
  • The closing tag is ?>
  • Everything between these tags is interpreted as PHP code
  • PHP code outside these tags is sent directly to the browser as HTML

How you'll be assessedProcess assessment · Outcome assessment · Knowledge assessment

Process assessment

  • Write basic PHP scripts.
  • Use PHP tags appropriately
  • Declare and initialize variables correctly.

Outcome assessment

Simple programs demonstrating the correct use of PHP syntax

Knowledge assessment

Detailed knowledge of:

Method used: The student should explain how:

  • PHP processes scripts on the server.

Principles: The student should explain the principles of:

  • separating PHP from HTML for maintainable code.

Theories: The student should explain:

  • the PHP concepts and program syntax
  • server-side scripting lifecycle, including request response cycles.

Circumstantial knowledge:

Detailed knowledge about:

  • Differences between server-side and clientside programming and their integration in web applications.

Question

Which pair of tags is used to mark the beginning and end of a PHP script?

Sign in to submit your answer and have it count toward your mastery.

Sign in to practice

Tutor

Stuck? Ask me anything about this topic.

Sign in to ask the Sonza AI Tutor about this question.

Sign in to ask

Discussions

No questions yet

Sign in to ask
Loading discussions…