ÓÃPHPʵÏÖÒ»¸öË«Ïò¶ÓÁÐ
<?php
class DoubleQueue
{
public $queue = array();
/**£¨Î²²¿£©Èë¶Ó **/
public function push($value)
{
return array_push($this->queue,$value);
}
/**£¨Î²²¿£©³ö¶Ó**/
public function pop()
{
return array_pop($this->queue);
}
/**£¨Í·²¿£©Èë¶Ó**/
public function enq($value)
{
return array_unshift($this->queue,$value);
}
/**£¨Í·²¿£©³ö¶Ó**/
public function deq()
{
return array_shift($this->queue);
}
/**Çå¿Õ¶ÓÁÐ**/
public function makeEmpty()
{
return unset($this->queue);
}
}
class DoubleDueue
{
public $queue = array();
public function push($value)
{
return $this->queue[] = $value;
}
public function pop()
{
$count = $this->count();
if($count >= 1)
{
$value = $this->queue[$count-1];
unset($this->queue[$count-1]);
return $value;
}
else
{
return false;
}
}
public function enq($value)
{
/*²»ºÃ×ö*/
}
public function deq()
{
/*²»ºÃ×ö*/
}
public function count()
{
return count($this->queue);
}
public function makeEmpty()
{
return unset($this->queue);
}
}
?>
Ã²ËÆÓÃÕâËĸöº¯Êý¾ÍÐÐ
array_push — ½«Ò»¸ö»ò¶à¸öµ¥ÔªÑ¹ÈëÊý×éµÄĩ⣨ÈëÕ»£©
array_unshift — ÔÚÊý×鿪ͷ²åÈëÒ»¸ö»ò¶à¸öµ¥Ôª
array_pop — ½«Êý×é×îºóÒ»¸öµ¥Ôªµ¯³ö£¨³öÕ»£©
array_shift — ½«Êý×鿪ͷµÄµ¥ÔªÒƳöÊý×é
Ïà¹ØÎĵµ£º
Apache 2 and PHP Installation
The following notes are how I got Apache 2 and PHP 5 (or PHP 4) working together on Linux. These instructions also apply, mostly, for any UNIX-like system, especially other Linux distributions. If you have a recent Linux distribution (say since 2002), you already hav ......
php evalº¯ÊýÓ÷¨----PHPÖÐeval()º¯ÊýС¼¼ÇÉ
eval
½«Öµ´úÈë×Ö·û´®Ö®ÖС£
Óï·¨: void eval(string code_str);
´«»ØÖµ: ÎÞ
º¯Ê½ÖÖÀà: Êý¾Ý´¦Àí
ÄÚÈÝ˵Ã÷
±¾º¯Ê½¿É½«×Ö·û´®Ö®ÖеıäÁ¿Öµ´úÈ룬ͨ³£ÓÃÔÚ´¦ÀíÊý¾Ý¿âµÄÊý¾ÝÉÏ¡£²ÎÊý code_str ΪÓû´¦ÀíµÄ×Ö·û´®¡£ÖµµÃ×¢ÒâµÄÊÇ´ý´¦ÀíµÄ×Ö·û´®Òª·ûºÏ PHP µÄ×Ö·û´®¸ñʽ£¬Í¬Ê±ÔÚ½ ......
<?php
/* Åжϳ£Á¿ÊÇ·ñ´æÔÚ*/
if (defined('MYCONSTANT')) {
echo MYCONSTANT;
}
//ÅжϱäÁ¿ÊÇ·ñ´æÔÚ
if (isset($myvar)) {
echo "´æÔÚ±äÁ¿$myvar.";
}
//ÅжϺ¯ÊýÊÇ·ñ´æÔÚ
if (function_exists('imap_open')) {
echo "´æÔÚº¯Êýimag_open\n";
} else {
echo "º¯Êýimag_open²»´æÔÚ\n";
}
//ÅжÏÀàÊÇ·ñ ......