declare is the process control structure of PHP, Directive currently supports two instructions, ticks use with the Register_tick_function function, see the following small example bar
The declare structure is used to set the execution instruction for a section of code, its syntax structure is as follows: code is as follows: DECLARE (Directive) statement don't understand? The popular explanation is as follows: Declare is the PHP Process Control structure, Directive currently supports two instruction "ticks and encoding", ticks use needs to match register_tick_function function (and of course unregister _tick_function function) is used. The ticks parameter represents a function that runs the number of statements called once register_tick_function. The Register_tick_function function defines the handler function at the time each tick event occurs. So what is the tick incident? Ick is an event. The Tick event occurs one time in PHP for each execution of n low-level statements, and n is specified by the Declare statement. You can use Register_tick_function () to specify the action that should be taken when the tick event occurs. Problem again, what is the low-level statement? It includes: Simple statements: Empty statements (on A; number), return, break, continue, throw, Goto, Global, Static, unset, ECHO, built-in HTML text, and the semicolon-terminated expression are counted as a single statement. Compound statement: The complete If/elseif, while, Do...while, for, foreach, switch, try...catch, etc. are counted as a statement. Statement BLOCK: A block of statements enclosed in {}. Finally Special: Declare block itself is also a statement (according to the reason declare block is also considered a compound statement, but here deliberately separate it out). See a simple example: The code is as follows: function Do_tick () {echo "<font color=red>do_tick</font>";} register_tick_fun Ction (' Do_tick '); DECLARE (ticks = 1) { for ($i = 1; $i < 5; $i + +) { &NBSP echo "<font color=blue>{$i}</font><br>"; }}