PHP declare statement logo
PHP Basics
What is PHP
PHP Introduction
PHP Basics
Install WAMP
Install PHP on Windows 7
PHP variables
PHP Syntax and Comments Overview
PHP Variable Types
Install PHP on Linux
Install PHP on Windows
PHP: String operator
PHP arrays
PHP Data Types - Arrays
PHP Array
PHP data types
PHP if statement
PHP if else statement
PHP assignment operators
PHP Quiz
PHP SimpleXML Parser
PHP Form
PHP Sending Emails
PHP return statement
PHP Data Types - Booleans
PHP Multidimensional Array
PHP while statement
PHP File Upload
PHP Captcha
PHP break
PHP Indexed Array
PHP For C Developers
PHP declare statement
PHP Echo Vs Print Statement
PHP Append to File
PHP logical operators - AND, OR, XOR, NOT
PHP Read File
PHP Projects: Create an Opinion Poll Application
PHP XML Introduction
PHP Error Handling
PHP Concatenation Operators
PHP Indexed, Associative, and Multidimensional Arrays
PHP XML Expat Parser
PHP data types - NULL
about the PHP programming language in general
PHP File
PHP Open File
PHP Design Patterns
PHP Useful Resources
PHP foreach loop
How Append a String in PHP
PHP $ and $$
PHP Cookies
PHP Array: Associative, Multidimensional
PHP comparison operators
PHP Include and Require
The pi() function
PHP Form Validation
PHP Switch Case Conditional Statements
PHP Mail
PHP Coding Standard
PHP Switch
PHP Form Introduction
PHP Loop: For, ForEach, While, Do While
PHP include statement
PHP Exception Handling
PHP Arrays Numeric, Associative and Multi-Dimensional
PHP Predefined Variables
PHP Control Structures: If else, Switch Case
PHP Constants
PHP Environment Setup Windows, Linux and Mac OS X
PHP switch statement
PHP Web Concepts Generating Dynamic Content
PHP Prepared Statements
PHP Ajax Auto Complete Search
PHP Date and Time
PHP Syntax Overview
PHP If, Else and Elseif Conditional Statements
What is PHP, and why do I need it?
PHP Server Side Form Validation
PHP Data Types : integers and floating point numbers
PHP Call By Reference
Sending Emails using PHP
Create RSS Feed in PHP
PHP Error Handling and Logging
PHP PayPal Integration
Free PHP Live Project Training in Real Time
PHP XML Parsers
Regular expressions in PHP
Discuss PHP
PHP do while statement
PHP Get ID of Last Inserted Record
PHP Looping
PHP Basics
Previous : PHP For C Developers Next : PHP Echo Vs Print Statement

PHP declare statement



In PHP declare construct is used to set execution directives for a block of code. At present two directives are recognized ticks and encoding.


declare (directive) statement 

The following table describes two directives currently supported.

Directive Description
ticks A tick is an event. While the format of specifying the tick directive is tick=N, where N is an integer. The tick event occurs for every N statements (following the declare). Usually, condition expressions and argument expressions are excluded from being executed. Register_tick_function() is used to specify each event(s) that occur on each tick. Remember that this directive is deprecated in PHP5.3.
encoding The encoding directive specifies a script's encoding. Usage of this detective is decal re(encoding="EncodingType") where EncodingType is a encoding type like ISO-8859-1. This directive can be used only if PHP is compiled with --enable-zend-multibyte. You can use phpinfo() to know whether a PHP installation

Example of PHP declare statement using tick directive

// the following function is called on each tick event
function w3r_tick()
echo "w3r_tick() called<br>";
$a = 5;
if ($a > 0)
$a += 2;

Previous : PHP For C Developers Next : PHP Echo Vs Print Statement
© Copyright 2018 W3Hello Publishing Limited. All rights reserved.
Contact us | Sitemap