PHP Ϊʲôfunction
PHP Ϊʲôfunction ÔÚÉùÃ÷ʱûÓÐÉùÃ÷²ÎÊý,¶øµ÷ÓÃʱ¼ÓN¸ö²ÎÊýÈ´ÊÇÔÊÐíµÄ
2008-11-13 20:14:38 ÆäËû | ÆÀÂÛ(7) | ä¯ÀÀ(721)
ÈçÌâ
//ÉùÃ÷
function test(){};
$a = '';
$b = '';
$c = '';
//µ÷ÓÃ
test($a,$b,$c,1,2,3);
ÏàÐŲ»ÉÙÐֵܽãÃÃÒ²Ôø¾Óöµ½Í¬ÑùµÄÎÊÌâ¡£
why?
¸Õ¿ªÊ¼ÎÒҲͦÓôÃÆ£¬ºó·ÁË·ÊÖ²áÕÒµ½ÁË´ð°¸
--------------------------------------
PHP supports passing arguments by value (the default), passing by reference, and default argument values. Variable-length argument lists are also supported, see also the function references for func_num_args(), func_get_arg(), and func_get_args() for more information.
---------------------------------------------
ÔÀ´PHPÖ§³Ö±ä³¤²ÎÊýÁÐ±í£¨Variable-length argument lists £©
int func_num_args(void)¿ÉÒԵõ½²ÎÊý³¤¶È
such as:
function test()
{
echo func_num_args();
}
test(0, 1, 2, 3); // ÏÔʾ: 4
mixed func_get_arg(int $arg_num)¿ÉÒԵõ½Ò»¸ö²ÎÊýÖµ
such as:
function test()
{
echo func_get_arg(2);
}
test('a', 'b', 'c'); //ÏÔʾ£ºc
array func_get_args(void) ¿ÉÒԵõ½Ò»×éarray²ÎÊý
such as:
function test()
{
var_dump(func_get_args());
}
test('a', 'b', 'c'); //ÏÔʾ£ºarray(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" }
PS£ºÓÐÎÊÌâ? ÏÈ·ÊÖ²á°É ^_^
Ïà¹ØÎĵµ£º
PHPÔËÐйý³Ì
¼òµ¥µãµÄ
ä¯ÀÀÆ÷ -> web·þÎñÆ÷ -> php½âÊÍÆ÷ -> mysql·þÎñÆ÷ -> php½âÊÍÆ÷ -> web·þÎñÆ÷ -> ä¯ÀÀÆ÷
´ó¼ÒÎÕ¼¸¸öÊÖ
¸´ÔÓµãµÄ ä¯ÀÀÆ÷ -----------------------------> web·þÎñÆ÷-> php½âÊÍÆ÷ -> mysql·þÎñÆ÷ ….
PHPÔËÐлúÖÆ
2009-10-20 ......
<?php
function checkMobile($str)
{
$pattern = "/^(13|15)\d{9}$/";
if (preg_match($pattern,$str))
{
Return true;
}
else
{
Return false;
}
}
$str = checkMobile("15800000001");
......
1.echo()ÊÇÒ»¸öphpÓï¾ä£¬ËùÒÔûÓзµ»ØÖµ£¬ÄÜ´òÓ¡¼òµ¥µÄÊý¾Ý¡£
2.print()ÊÇÒ»¸öº¯Êý£¬Óзµ»ØÖµ£¬ÄÜ´òÓ¡¼òµ¥µÄÊý¾Ý¡£
3.print_r()ÊÇÒ»¸öº¯Êý£¬ÄÜ´òÓ¡¸´ÔÓµÄ(mix)Êý¾Ý¡£
È磺
<?
$value = print 'hello word<br>';
echo "the value is $value<br>";
$arr = array('name'=>'wangking','qq'=>'12345 ......
PHP trim() º¯Êý
¶¨ÒåºÍÓ÷¨
trim() º¯Êý´Ó×Ö·û´®µÄÁ½¶Ëɾ³ý¿Õ°××Ö·ûºÍÆäËûÔ¤¶¨Òå×Ö·û¡£
Óï·¨
trim(str,charlist)
²ÎÊý 1 strΪ´ý²Ù×÷µÄ×Ö·û´®£¬²ÎÊý 2 charlist ¿ÉÑ¡£¬Ö¸¶¨ÁËÏëҪȥ³ýµÄÌØÊâ·ûºÅ¡£
Èç¹ûµÚ¶þ¸ö²ÎÊýû¸øÖµ£¬Ô¤Éè»áÈ¥³ýÏÂÁÐÕâЩ×ÖÔª£º
" " (ASCII 32&nbs ......
<?php
/*
* Created on 2008-10-25
*
* developer by Alex.do QQ:20779512
* PHP 5.0
*/
class mdbClass {
var $dbPath = 'database/#123123#.mdb'; //Êý¾Ý¿â·¾¶
var $tabName; & ......