echo a static varible

Some thing that may be obvious to the seasoned PHP programmer, but may surprise someone coming over from C++:




Gives an error saying Print used undefined variable. One has to explicitly use (notice the use ofbar ?>):


$bar;
}
}
?>


bar; ?> refers to the class member, while using $barmeans using an uninitialized variable in the local context of the member function.

你可能感兴趣的:(echo a static varible)