phpǶÈëhtml
<?php
function outputMyName($fname) {
echo "ÎÒµÄÃû×ֽР";
echo "ÖÜ ".$fname."<br />";
}
?>
<html>
<body>
<?php
outputMyName("ʤ³¬");
outputMyName("Óîºã");
outputMyName("ÓîÃË");
?>
</body>
</html>
½á¹ûÈçÏ£º
ÎÒµÄÃû×ֽРÖÜ Ê¤³¬
ÎÒµÄÃû×ֽРÖÜ Óîºã
ÎÒµÄÃû×ֽРÖÜ ÓîÃË
Ïà¹ØÎĵµ£º
PHPµÄÊý¾ÝÀàÐ͵Äת»»ÓÐÁ½ÖÖ·½·¨¿ÉÒÔ°ìµ½£ºÖ±½ÓÊäÈëÄ¿±êµÄÊý¾ÝÀàÐͺÍͨ¹ýsettypeº¯ÊýʵÏÖ¡£
PHPÊý¾Ýת»»³ÉÕûÊý
FloatÐÍÊý¾Ýת»»³ÉintÐÍ
FloatÐÍת»»³ÉintÐÍ£¬Ð¡ÊýµãºóµÄÊý½«±»ÉáÆú¡£Èç¹ûfloatÊý³¬¹ó³¬¹ýÁËÕûÐ͵ÄÈ¡Öµ·¶Î§£¬ÄÇô½á¹û¿ÉÄÜÊÇ0»òÕßÊÇÕûÐεÄ×îС¸ºÊý¡£
ÀýÈ磺
<?php
$php = 1.59;
echo (int)$php.&rdquo ......
PHPÖÐͨ³£Óм¸ÖÖ×Ô¶¨Ò庯ÊýµÄ·½·¨£¬ÏÂÃæ½éÉÜһϣ¬ÎÒÃÇʹÓõÄÊÇÕâÖÖ·½Ê½£º
<?php
function foo($arg)
{
return $arg
}
?>
µ±Ä³Ð©²ÎÊýΪ¿ÉÑ¡ÊÇ£¬¿ÉÒÔÕâÑù¶¨Ò壺
<?php
function foo($arg = NULL)
{
return $arg == NULL ? "" : $arg;
}
?>
µ±ÎÒÃDz»ÏÞÖƲÎÊý¸öÊýµÄʱºò£¬Ò²¿ÉÒ ......
Code:
<?php
function genRandomString($len)
{
$chars = array(
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
"w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N", "O", ......
run_time.php Code:
<?php
class runtime
{
var $StartTime = 0;
var $StopTime = 0;
function get_microtime()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
function start()
{
$this->StartTime = $this->get_microtime();
}
f ......