php »ù´¡±Ê¼Ç functions
/***************************by
garcon1986********************************/
<?php
//example1
$makefoo = true;
bar();
if($makefoo){
function foo(){
echo "doesn't exist.<br>";
}
}
if($makefoo)foo();
function bar(){
echo "exist<br>";
}
//example2
function sjg(){
function wl(){
echo 'must call sjg() before wl()!<br>';
}
}
sjg();
wl();
//wl();
//sjg();
//example3 - µÝ¹é
$a = 10;
function recursion($a){
if($a <= 20){
echo "$a\n";
recursion($a+1);
}
}
recursion($a);
echo "<br>";
//example4 - Ïòº¯Êý´«µÝÊý×é
$input1=array('hi','ni','hao','ya');
function record($input1){
echo $input1[0],$input1[1],$input1[2];
}
record($input1);
//pass the function's parameter by reference
function add_some_extra(&$string){
$string .= 'wl wo ai ni.';
}
$str1 = 'wo xiang shuo,';
add_some_extra($str1);
echo $str1.'<br>'; //output: wo xiang shuo, wl wo ai ni.
//default parameter ĬÈϲÎÊý
function makecoffee($category = "cappuccino"){
//return "makeing a cup of $category.\n";
echo "making a cup of $category";
}
echo makecoffee().'<br>';
echo makecoffee("espresso").'<br>';
// add one more parameter
function makeyogurt($type = "acidophilus", $flavour)
{
return "making a bowl of $type and $flavour\n".'<br>';
//return "Makin a bowl of $flavour\n";
}
echo makeyogurt("","raspberry"); // won't work as expected
//echo makeyogurt();
function makeyogurt2($flavour,$type = "acidophilus")
{
//return "making a bowl of $type and $flavour\n".'<br>';
return "Makin a bowl of $flavour $type\n";
}
echo makeyogurt2("raspberry").'<br>'; // will work as expected
//return ʾÀý
function square($num){
return $num * $num;
}
echo square(4).'<p>';
function small_numbers(){
return array(0,1,2);
}
list($ze
Ïà¹ØÎĵµ£º
½ñÌìΪÁËһЩÒÑÓÐÊý¾Ýµ¼ÈëMYSQLµÄÊý¾Ý¿â£¬ÎÒдÁËÒ»¸öºÜ¼òµ¥µÄPHP³ÌÐò¡£
³ÌÐò˼·ºÜ¼òµ¥£¬¾ÍÊǶÁÒ»ÌõÊý¾Ý£¬È»ºóÍùMYSQLÀï²åÈëÒ»Ìõ¡£
½á¹û×ÜÊÇ·¢ÏÖ Ã¿´Îµ¼ÈëÖ»Äܵ¼Èë2000Ìõ£¬¾Í×Ô¶¯Í£Ö¹ÁË£¬¶øÇÒûÓÐÈκÎÌáʾ¡£
ÔÚÍøÉÏËѽâ¾ö·½°¸¸÷ÖÖËѲ»µ½¡£
¸Õ¿ªÊ¼»³ÒÉÊÇÄڴ滺³å¸øÉÙÁË£¬µ÷ÁËһϣ¬»¹ÊDz»ÐС£¡£
×îºó·¢ÏÖÒ»¸ö¹æÂÉ£¬¾ÍÊÇ ......
ÔÎÄÁ´½Ó£ºhttp://www.phpdo.net/index.php/2010/02/11/1-14/
PHPÖлñµÃÈÕÆÚʱ¼äÐÅÏ¢µÄº¯Êý——Getdate
ʱ¼ä´Á:°üº¬ÁË´ÓunixмÍÔª£¨1970Äê1ÔÂ1 ÈÕÁãʱ£©µ½¸ø¶¨Ê±¼äµÄÃëÊý£¬ÊÇÒ»¸ö³¤ÕûÊý¡£
Getdateº¯Êý¾ÍÊÇÓÃÀ´»ñµÃµ±Ç°Ê±¼ä£¬»òÕßÓÃÀ´·ÖÎöʱ¼ä´ÁµÄ¾ßÌåÒâÒå¡£Óï·¨£º
Array getdate([int timestamp])
º¬Ò壺ti ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>PHP·ÖÒ³</tit ......
ºÜ¾ÃûÓÐЩһЩÓÐÓô¦µÄµÄ¶«Î÷ÁË£¡½ñÌì¾Í²»ºúÂÒµÄд¶«Î÷ÁË!дһЩÓÐÓõ졵±È»Ç°ÌáÏÂÊǺܸÐлºÜ¶à¾³£À´ÎÒ²©¿ÍµÄÅóÓÑһϣ¡¶àл´ó¼Ò£¡£¡£¡£¡£¡
½ñÌìдµÄÊǹØÓÚphp»·¾³¼ÜÉèµÄµÚÒ»ÖÖ·½Ê½£¡µ±È»ÎҾͲ»½ØÍ¼ÁË£¡´ó¼ÒÖ»Òª°´ÕÕ²Ù×÷¾Í¿ÉÒÔʵÏֵģ¡
Ò»¡¢°²×° PHP £º±¾ÎÄPHP°²×°Â·¾¶È¡ÎªD:\php\php4\(Ϊ±Ü»ìÏý£¬PHP5.1.x°æ±¾°²×°Â·¾ ......
Nginx + PHP + Mysql (php-frm 방식)
글쓴이 :
최고관리자
조회 : 2,884
......