« Back to Product

Documentation

RegisterTimer

Require: IP-Symcon >= 4.0

 void RegisterTimer (string $Name, int $Interval, string $ScriptContent) 

Parameters

Name

Name of the timer

Interval

Interval in milliseconds with which the timer should be created. 0 = never

ScriptContent

PHP script without PHP tags (<?php ... )

Returns

No Return

Description

This function creates a timer with the name Name. It can also be specified which interval is to be set when creating and the script content will be defined.
The timer is stateless. Therefore, following each restart the timer is set anew with the interval previously set here. Interval settings must be reloaded in ApplyChanges().

Warning

The timer can only be created in the "Create ()" function. If the timer is to be switched off or not to start: SetTimerInterval to 0.

Warning

The content of script content is overwritten every time, therefore the correct content can always be guaranteed, even after changes.

Example

// Creates a timer named "Update" with an interval of 5 seconds. 
$this->RegisterTimer("Update", 5000, "echo 'Hello World';");
Any questions?