Ticks have been deprecated as of PHP 5.3. Ticks will be removed completely from PHP 6 onwards |
declare (directive) { statement }There are two declare directives in PHP.
bool register_tick_function (callable $function [, mixed $arg [, mixed $... ]])
void unregister_tick_function (string $function_name)void unregister_tick_function (string $function_name)
Not all statements are tickable.Condition expressions and argument expressions are not tickable. register_tick_function() is used to register the occurrence of ticks |
<?php declare(ticks=1); function Handler() { echo "Handler called <br>"; } register_tick_function('Handler'); echo "Hello <br>"; ?> ?>
Note : declare(ticks=1); is used to tells php to call tick handler for every function.Output
Handler called Hello Handler called Handler called
declare(encoding=ENCODING_VALUE); OR declare(encoding=ENCODING_VALUE) { //for a block }
<?php declare(encoding='ISO-8859-1'); echo "Script is encoded using ISO-8859-1"; ?>
Output
Script is encoded using ISO-8859-1