<?php
define('a', 0);
$b = 0;
class foo {
private $c = 0;
private static $e = 0;
private static $f = '0';
public function techo() {
echo ' direct -->' . 0 . '<br />';
echo ' a --> ' . a . '<br />';
echo ' (string)a --> ' . (string)a . '<br />';
global $b;
echo ' b --> ' . $b . '<br />';
echo ' c --> ' . $this->c . '<br />';
$d = 0;
echo ' d --> ' . $d . '<br />';
echo ' e --> ' . $this->e . '<br />';
// OK, static creates a reference, so?
echo ' (int)e --> ' . (int)$this->e . '<br />';
echo ' (string)e --> ' . (string)$this->e . '<br />';
// What? Why?
echo ' f --> ' . $this->f . '<br />';
// OK, static creates a reference, so?
echo ' (int)f --> ' . (int)$this->f . '<br />';
echo ' (string)f --> ' . (string)$this->f . '<br />';
// What? Why?
}
public function techo2() {
echo ' direct -->', 0, '<br />';
echo ' a --> ', a, '<br />';
echo ' (string)a --> ', (string)a, '<br />';
global $b;
echo ' b --> ', $b, '<br />';
echo ' c --> ', $this->c, '<br />';
$d = 0;
echo ' d --> ', $d, '<br />';
echo ' e --> ', $this->e, '<br />';
// OK, static creates a reference, so?
echo ' (int)e --> ', (int)$this->e, '<br />';
echo ' (string)e --> ', (string)$this->e, '<br />';
// What? Why?
echo ' f --> ', $this->f, '<br />';
// OK, static creates a reference, so?
echo ' (int)f --> ', (int)$this->f, '<br />';
echo ' (string)f --> ', (string)$this->f, '<br />';
// What? Why?
}
public function techo3() {
global $b;
$d = 0;
echo ' direct -->', 0, '<br />',
' a --> ', a, '<br />',
' (string)a --> ', (string)a, '<br />',
' b --> ', $b, '<br />',
' c --> ', $this->c, '<br />',
' d --> ', $d, '<br />',
' e --> ', $this->e, '<br />',
// OK, static creates a reference, so?
' (int)e --> ', (int)$this->e, '<br />',
' (string)e --> ', (string)$this->e, '<br />',
// What? Why?
' f --> ', $this->f, '<br />',
// OK, static creates a reference, so?
' (int)f --> ', (int)$this->f, '<br />',
' (string)f --> ', (string)$this->f, '<br />';
// What? Why?
}
}
$foo = new foo( );
function mytime( ) {
$time = microtime( );
$time = explode( " ", $time );
$time = $time[1] + $time[0];
return $time;
}
$time1 = mytime( );
$foo->techo( );
$time2 = mytime( );
$totaltime = ($time2 - $time1);
echo '<br /><br />techo() --> ', $totaltime, '<br /><br /><br />';
$time1 = mytime( );
$foo->techo2( );
$time2 = mytime( );
$totaltime = ($time2 - $time1);
echo '<br /><br />techo2() --> ', $totaltime, '<br /><br /><br />';
$time1 = mytime( );
$foo->techo3( );
$time2 = mytime( );
$totaltime = ($time2 - $time1);
echo '<br /><br />techo2() --> ', $totaltime, '<br /><br /><br />';
?>
I believe yes
On Sun, Aug 31, 2008 at 5:37 PM, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:
On Sun, 2008-08-31 at 17:09 +0200, Jochem Maas wrote:
Diogo Neves schreef:
Hi all,
Why a static var don't cast as a dynamic one?
See file for more info...
attachments get stripped.
don't cross post to internals, it's bad form.
try and formulate your questions a bit better
(it should take you more time to write your post than
it takes for someone else to figure out what your going on about.).