Ticks
Aus php bar
Ticks sind Compilerschritte. PHP erlaubt das Definieren von Tickfunktionen. Code kann in declare-Blöcke gepackt werden, nach n Zeilen Code wird auf die Tick-Funktion zurückgegriffen.
Beispiel zur Variablenüberwachung mit Hilfe von Ticks:
1 <?php 2 function watchVar($varname) { 3 global $$varname; 4 static $oldValue; 5 6 if($$varname !== $oldValue) { 7 echo '$'.$varname.' wurde geaendert von "'.$oldValue.'" auf "'.$$varname.'"<br />'; 8 $oldValue = $$varname; 9 } 10 } 11 12 register_tick_function('watchVar', 'myVar'); 13 14 declare(ticks=1) { 15 $myVar = 'foo'; 16 $yourVar = 'bar'; 17 $myVar = 1; 18 $myVar++; 19 } 20 ?>
Ausgabe:
$myVar wurde geändert von "" auf "foo" $myVar wurde geändert von "foo" auf "1" $myVar wurde geändert von "1" auf "2"
Links
http://de.php.net/manual/de/control-structures.declare.php
http://de.php.net/manual/de/function.register-tick-function.php
http://de.php.net/manual/de/function.unregister-tick-function.php
Link Exchange : Android - vietnam guide - Vietnam Directory - Dich vu seo - cong ty seo - thoi trang vay - Danh ba web - Thiet ke web gia re - thiet ke phong hat - thiet ke web seo - thiet ke web ha noi - thiet ke web bac ninh - seo tips - the tips - vietnam travel - china travel - Vietnam airlines

