TICKS

PHP code

<?php
/*
 * 
 * opcode number: 105
 */
// A function that records the time when it is called
function profile()
{
   echo "profile function is called\n";
}

// Set up a tick handler
register_tick_function("profile");

// Initialize the function before the declare block
profile();

// Run a block of code, throw a tick every 2nd statement
declare(ticks=2) {
   for ($x = 0; $x < 10; ++$x) {
         echo "hello world\n";
   }
}
?>

PHP opcodes

Function name: (null)

Compiled variables: !0=$x

line#opfetchextreturnoperands
70NOP    
131SEND_VAL   'profile'
 2DO_FCALL 1 'register_tick_function'
163DO_FCALL 0 'profile'
204ASSIGN   !0,0
 5IS_SMALLER  ~3!0,10
 6JMPZNZ 9 ~3,->13
 7PRE_INC   !0
 8JMP   ->5
219ECHO   'hello+world%0A'
 10TICKS   2
2211TICKS   2
 12JMP   ->7
 13TICKS   2
2314TICKS   2
2415RETURN   1

Function name: profile

Compiled variables: none

line#opfetchextreturnoperands
90ECHO   'profile+function+is+called%0A'
101RETURN   null