Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3226854
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:30:21+00:00 2026-05-17T16:30:21+00:00

I found a chunk of code that I haven’t seen before: declare(ticks = 1);

  • 0

I found a chunk of code that I haven’t seen before:

declare(ticks = 1);
pcntl_signal(SIGINT, array($this, "catchSignal"));
pcntl_signal(SIGTERM, array($this, "catchSignal"));

I looked up the function in the PHP documentation, but I still don’t understand what this is used for. Please help me understand what this is used for and some examples of where this should be implemented.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:30:22+00:00Added an answer on May 17, 2026 at 4:30 pm

    The declare statement states to check for events every “tick”. A “tick” being roughly equal to a line of code. This is used in command line PHP scripts so you can catch interrupts and shutdown the script gracefully instead of just killing it.

    The array($this, "catchSignal") in the pcntl_signal function is an odd work around (in my opinion) to support “objects” as parameters. Normally you would just do $this->catchSignal(), but PHP doesn’t accept class objects as parameters in this case. Thus the “array” syntax.

    Basically, if the script is issued an Interrupt or Termination signal, call the $this->catchSignal() function before shutting down.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This morning we found an old chunk of code that was causing a library
Found a piece of code today, that I find a little smelly... TMyObject.LoadFromFile(const filename:
I found this open-source library that I want to use in my Java application.
I have found myself having to turn a chunk of Lua code into a
I have a chunk of code where it appears that a variable is changing
We have a chunk of code something like this // semi-pseudo code def result
Graphael doesn't have an unhover event for some odd reason. Found this chunk of
Not really sure what's causing this, all I've found on google is that forgetting
Found some old code, circa VS 2003. Now I have just VS 2008 (SP1)
Found the following in an Oracle-based application that we're migrating (generalized) : SELECT Table1.Category1,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.