Interesting results using the "declare" construct...
Posted: Mon Jan 18, 2010 8:48 pm
All,
I'm currently writing a small article on using the "declare" construct, but I've run into something that has puzzled me. When issuing the following code, I notice the expected 2 results of "I was called from a tick!" statement.
However, when I run this set of code, I get 3!
This also results with 3!
I realize this must be because of some low-level instructions that PHP is executing, but what are those low-level instructions that execute on a blank declare or is this just a bug?
-Jon
I'm currently writing a small article on using the "declare" construct, but I've run into something that has puzzled me. When issuing the following code, I notice the expected 2 results of "I was called from a tick!" statement.
Code: Select all
<?php
function my_callback_function() {
echo "I was called from a tick!<br />";
}
register_tick_function("my_callback_function");
declare(ticks = 1) {
$x = 10;
}
?>
Code: Select all
<?php
function my_callback_function() {
echo "I was called from a tick!<br />";
}
register_tick_function("my_callback_function");
declare(ticks = 1) {
// $x = 10;
}
?>
Code: Select all
<?php
function my_callback_function() {
echo "I was called from a tick!<br />";
}
register_tick_function("my_callback_function");
declare(ticks = 1) {
}
?>
-Jon