PHP/declare

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< PHP
Revision as of 13:27, 16 July 2023 by Woozle (talk | contribs) (Created page with "{{fmt/title|PHP: declare()}} The [documentation for the <tt>declare()</tt> keyword is somewhat scattered. The [https://www.php.net/manual/en/control-structures.declare.php mai...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
PHP: declare()

The [documentation for the declare() keyword is somewhat scattered. The main documentation page mentions only "ticks" and "encoding" as directives, but there's at least one other.

directive description
encoding type of character encoding to use
strict_types If set to 1, only a value corresponding exactly to the type declaration will be accepted, otherwise a TypeError will be thrown. The only exception to this rule is that an int value will pass a float type declaration.
ticks If set to 1, functions registered with [register_tick_function() https://www.php.net/manual/en/function.register-tick-function.php] will be called in the middle of other code operations.