BMH子串查找算法(PHP实现)
代码interface StringSearchable
{
public function search($substring, $buffer);
}
class BoyerMooreStringSearch implements StringSearchable
{
public $substring = null;
public $buffer = '';
public $jumpTable = array();
protected $results = array();
public function __construct()
{
}
public function __destruct()
{
}
public function search($substring, $buffer)
{
$this->results = array();
$this->substring = $substring;
$this->buffer = $buffer;
$this->deriveJumpTable();
$substringLen = strlen($this->substring);
$currentCharIndex = $substringLen - 1;
$bufferLen = strlen($this->buffer);
while ($currentCharIndex < $bufferLen) {
for ($i = $substringLen - 1; $i >= 0; $i--) {
&nb
相关文档:
$_SERVER['PHP_SELF'] #当前正在执行脚本的文件名,与 document root相关。
$_SERVER['argv'] &n ......
<?php
/**
* 把一个汉字转为unicode的通用函数,不依赖任何库,和别的自定义函数,但有条件
* 条件:本文件以及函数的输入参数应该用utf-8编码,不然要加函数转换
* 其实亦可轻易编写反向转换的函数,甚至不局限于汉字,奇怪为什么PHP没有现成函数
* @author xieye
*
* @param {string} $word 必须是一个汉 ......
几天没有更新的blog这两天在写个小东西玩玩
现在是基本能用了
最近没什么事做,就想到了查看服务端目录的小程序玩玩
现在查看已经写完了发上来给大家看看
demo地址
http://www.web-jia.com/demo/folder/demo.html
我分享的代码欢迎大家来下载啊
下载可以到
http://www.web-jia.com/viewthread.php?tid=2832&ext ......
最近在学PHP ,觉得比较简单,可能是因为有一点编程经验的缘故吧,今天教大家用PHP制作通讯录,功能比较简单,第一次做网页教程,而且不是很有PHP经验,所以不足的地方大家留言告诉我,废话不多说,现在开始
环境:Windows XP SP3 + PHP5 + apache2 + mysql5
首先创建一个数据库,名为 MyDB (我这里使用的是MySQL),SQL ......