PHP˳ÐòÅÅÐò
PHPµÄËã·¨¶¼ÓÐÄÄЩÄØ£¿
ÎÒ»¹¼ÇµÃÉÏ´óѧÄÇ»áѧÊý¾Ý½á¹¹Ê±£¬Á˽âÁË:˳Ðò·¨¡¢Ã°ÅÝ·¨¡¢¶þ·Ö·¨ÒÔ¼°¶ÔÏßÐÔ±íÒÔ¼°Êý¾ÝÈëÕ»¡¢³öÕ»µÄ²Ù×÷¡£
PHPÖеÄ˳Ðò·¨¾ÍÊǶÔÊý×éÔªËصÄÖðÒ»±È½Ï¶øµÃµ½µÄ¡£
ÀýÈ磺
<?php
function order($php,$k)
{
$n = count($php); //¼ÆËãÊý×é¸öÊý
$php[$n] = $k;
//˳ÐòÅÅÐò
for($i = 0;$i < $n;$i++)
{
if($php[$i] == $k) //µÚÒ»¸ö
{
break;
}
}
if($i < $n) //ÔÚ×îºóÒ»¸ö֮ǰÕÒµ½
{
return $php[$i];
}
else //ûÓÐÕÒµ½
{
return -1;
}
}
$php = array("php","phpdo","www.phpdo.net");
echo order($php,"php");
?>
½á¹ûÊÇ£º
PHP
ÔÎÄÁ´½Ó£ºhttp://www.phpdo.net/index.php/sort-order.html
Ïà¹ØÎĵµ£º
ÖÕÓڷżÙÁË£¬ÕýÏëÔÚÕâ¸ö¼ÙÆÚÀïѧѧPHP£¬ÓÉÓÚ×Ô¼ºÓõÄÊÇ×ÀÃæ°æµÄUbuntu8.04,ÓÚÊǾÍÏë¼ÜÉèÒ»¸öLAMP»·¾³À´Ñ§PHP£¬Ò²³Ã´Ë»ú»áѧһÏÂPHP·þÎñÆ÷µÄ¼ÜÉè¡£
Ò»¡¢°²×°Ubuntu8.04
ËäȻ˵ÊÇÅäÖÃLAMP»·¾³£¬µ«ÔÚÎÄÕÂÀï²¢²»»á½²ÊöÈçºÎ°²×°Ubuntu8.04,ÒòΪ¹ØÓÚÈçºÎUbuntu8.04ÔÚÍøÉÏÒѾÓкܶàµÄ½Ì³ÌÁË£¬¾ÍËãÊÇÓ²ÅÌ°²×°Ò²ÊÇÒ»¼þºÜ¼òµ¥µÄÊÂÁ ......
£¨1£©
Warning: mysql_query() [function.mysql-query]: Access denied for user
'ODBC'@'localhost' (using password: NO) in C:\Program Files\Apache
Software Foundation\Apache2.2\htdocs\TM\conn\conn.php on line 32
Warning: mysql_query() [function.mysql-query]: A link to the server could
not be est ......
//»ñÈ¡ url
function match_links($document) {
preg_match_all("'<\s*a\s.*?href\s*=\s*([\"\'])?(?(1)(.*?)\\1|([^\s\>]+))[^>]*>?(.*?)</a>'isx",$document,$links);
while(list($key,$val) = each($links[2])) {
if(!empty($val))
$match[] = $val;
}
......
//È¥³ý script ½Å ±¾
function delScript($string){
$pregfind = array("/<script.*>.*<\/script>/siU",'/on(mousewheel|mouseover|click|load|onload|submit|focus|blur)="[^"]*"/i');
$pregreplace = array('','');
$string = preg_replace($pregfind, $pregreplace, $string);
return $str ......