PHP enddeclare Keyword

P
PHP endfor Keyword
PHP empty Keyword

In this article, you will learn about enddeclare keyword in PHP. The enddeclare keyword in PHP is used to close a declare block which was started using the declare(…): syntax.

examples of the ENDDECLARE keyword

Example 1. In this example, we close a declare block.

<?php
$count = 0;
function example() {
  global $count;
  $count++;
  echo "$count instructions executed<br>";
}
register_tick_function('example');

declare(ticks=1):
  $cars = ["Ford", "Volvo", "BMW"];
  foreach($cars as $car) {
    echo "$car <br>";
  }
enddeclare;
?>
PHP endfor Keyword
PHP empty Keyword

Tutor Network

Share this

Learn PHP from A to Z