PHP enddeclare Keyword

❮ PHP Keywords

Example

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;
?>
Try it Yourself »

Definition and Usage

The enddeclare keyword is used to close a declare block which was started using the declare(...): syntax.


Related Pages

The declare keyword.


❮ PHP Keywords
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.