Results 1 to 6 of 6

Thread: What is the Declare Construct in PHP?

  1. #1
    Join Date
    Aug 2006
    Posts
    287

    What is the Declare Construct in PHP?

    Hi friends,
    I have recently started with the programming language PHP. Before that I have completed C, C++ and Core Java. I have also done HTML and basics of JavaScript. I want to know about the declare construct. I have used others but I don't know much about the declare. So thought that you guys can explain me properly (as usual). Please tell what is the Declare Construct in PHP.?? Any other information related would be grateful.!
    Dimension 1100 (FMY032J) mini-tower
    2.53ghz Intel Pentium 4
    80 gig nfts HDD
    512 RAM
    Main circuit board: Dell 0CF458
    BIOS: Dell A00
    Display: Intel(R) 82865G Graphics Controller [Display adaptor]
    Multimedia: Sound MAX Integrated Digital Audio
    Windows XP Home SP2

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: What is the Declare Construct in PHP?

    The declare construct is used to set execution directives for a block of code. Also can be defined as the element of declarative language used to add instructions executed in a block of code. The syntax of declare is similar to the syntax of other flow control :
    PHP Code:
    declare (directive)
        
    statement 
    The directive section allows the behavior of the declare block to be set.

  3. #3
    Join Date
    Nov 2005
    Posts
    1,323

    Re: What is the Declare Construct in PHP?

    The directive section allows the behavior of the declare block. Currently, only two directives are recognized: the ticks directive and Directive encoding encoding. The encoding directive was added in PHP 5.3.0. The term orders declare block will be executed. How it will be enforced and what effects this will have depends on the directive set in the directive block. The declare construct can also be used in the global context.

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Re: What is the Ticks of Declare Construct in PHP?

    Tick : A tick is an event that occurs for every N low-level tickables executed by the parser within the declare block. The value of N is specified by the syntax ticks= N within the declare blocks's directive. An event that occurs at each tick are specified using the register_tick_function (). All orders are tickables. Typically, the condition expressions and expressions of arguments are not tickables.

  5. #5
    Join Date
    May 2008
    Posts
    2,389

    Re: What is the Declare Construct in PHP?

    I an providing you an example of the Tick usage. You can understand when to use the tick after looking to the following example :
    PHP Code:
    <?php
     
    declare(ticks=1);

    function 
    tick_handler()
    {
        echo 
    "tick_handler() called\n";
    }
     
    register_tick_function('tick_handler');
     
    $a 1;
     
    if (
    $a 0) {
        
    $a += 2;
        print(
    $a);
    }
     
    ?>

  6. #6
    Join Date
    Jul 2006
    Posts
    289

    Re: What is the Declare Construct in PHP?

    The encoding of a script can be specified by script using the encoding directive. The following example demonstrates how to declare an encoding for the script :
    PHP Code:
    <?php
    declare(encoding='ISO-8859-1');
    .....
    // code here
    .....
    ?>
    Signatures reduce available bandwidth

Similar Threads

  1. Need help to construct a DVD server
    By Jaromierz in forum Hardware Peripherals
    Replies: 5
    Last Post: 19-05-2011, 10:15 AM
  2. How to declare the header() function in php?
    By Joko in forum Software Development
    Replies: 3
    Last Post: 10-09-2009, 03:28 PM
  3. How to declare const variable in C++
    By AZUL in forum Software Development
    Replies: 3
    Last Post: 02-09-2009, 06:36 PM
  4. How to declare a cotaskmemfree
    By Patrickboy in forum Software Development
    Replies: 3
    Last Post: 24-06-2009, 12:09 PM
  5. How to declare print function in PHP
    By Aanand in forum Software Development
    Replies: 3
    Last Post: 29-05-2009, 12:28 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,120,225.78347 seconds with 17 queries