phpÖÐµÄ Àà³£Á¿ Class Constants
It is possible to define constant values on a per-class basis remaining the same and unchangeable.
Constants differ from normal variables in that you don't use the $ symbol to declare or use them. Like static members, constant values cannot be accessed from an instance of the object (using $object::constant).
˵Ã÷£º const ³£Á¿ ²»Óà $ ·ûºÅ
const ²»¼Ó¹Ø¼ü×Ö private ÐÞÊÎ //Like static members,
²»ÄÜͨ¹ý ¶ÔÏó·ÃÎÊ¡£ Ö»ÄÜͨ¹ýclass·ÃÎÊ
Àý×Ó 19-15. Defining and using a constant
<?php
class MyClass
{
const constant = 'constant value';
function showConstant() {
echo self::constant . "\n";
}
}
echo MyClass::constant . "\n";
$class = new MyClass();
$class->showConstant();
// echo $class::constant; is not allowed
?>
Ïà¹ØÎĵµ£º
function handleEach(&$array,$functionName)
{
foreach($array as $k=>$v)
{
if(is_array($v))
{
handleEach(&$array[$k],$functionName);
}
else
$array[$k] = $functionName($v);
return $array[$k];
}
} ......
1:·ÅÁË6¸öÎļþÔÚcÅÌÏÂ(php5ts.dll,libmysql.dll ,php_gd2.dll,php_mysql.dll,php_mbstring.dll ),Ò»¸öÔÚwindowsÏÂ,ÁíÎå¸öÔÚwindows/system32ÏÂ
2:ÅäÖÃÁËpath
3:ÃüÁî:httpd.exe -w -n "Apache2" -k start À´²é¿´ÊÇÄÄÒ»ÐеĴíÎóÐÅÏ¢.
×ܽá:µ½ÏÖÔÚΪֹ,ÕûÁËÒ»Ìì,×°ÁËÈý´ÎϵͳµÄÂé·³ÖÕÓÚÇ×ÉíÖ¤Ã÷ÁË,
Õâ¸ö×ï¿ý»öÊײúÉúµÄÔÒò ......
i £ºÈç¹ûÔÚÐÞÊηûÖмÓÉÏ"i"£¬ÔòÕýÔò½«»áÈ¡Ïû´óСдÃô¸ÐÐÔ£¬¼´"a"ºÍ"A" ÊÇÒ»ÑùµÄ¡£
U£ººÍÎʺŵÄ×÷Óò¶à£¬ÓÃÓÚÉèÖÃ"̰À·Ä£Ê½"¡£
m£ºÄ¬ÈϵÄÕýÔò¿ªÊ¼"^"ºÍ½áÊø"$"Ö»ÊǶÔÓÚÕýÔò×Ö·û´®Èç¹ûÔÚÐÞÊηûÖмÓÉÏ"m"£¬ÄÇô¿ªÊ¼ºÍ½áÊø½«»áÖ¸×Ö·û´®µÄÿһÐУºÃ ......