易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关文档:

php 汉字转化成 二进制 十进制 十六进制 数字

<?php
/**
* 把一个汉字转为unicode的通用函数,不依赖任何库,和别的自定义函数,但有条件
* 条件:本文件以及函数的输入参数应该用utf-8编码,不然要加函数转换
* 其实亦可轻易编写反向转换的函数,甚至不局限于汉字,奇怪为什么PHP没有现成函数
* @author xieye
*
* @param {string} $word 必须是一个汉 ......

学习PHP(1)

基本语法
我的第一个PHP:Hello World
<?php
echo"Hello World!";
?>
显示结果为 Hello World!
变量
PHP中,所有的变量都以标识“$”开头:
<?php
$str1 = "Hello World!";
echo $str1;
?>
显示结果为 Hello World!
PHP中使用“.”符号连接不同的字符串。举例如下:
<?p ......

PHP操作mysql数据库简单示例

先创建一个数据库MyDB
CREATE DATABASE `mydb` ;
再创建一个简单的数据表
CREATE TABLE `MyDB`.`MyTable` (
`Name` VARCHAR( 20 ) NOT NULL ,
`Age` INT NOT NULL
) ENGINE = MYISAM
插入一些数据
INSERT INTO `mydb`.`mytable` (
`Name` ,
`Age`
)
VALUES (
'Jim', '15'
), (
'Amy', '16'
), (
'Jack' ......

使用PHP程序直接调用文本文件的内容

 
如何用php直接调用文本文件内容:首先通过file函数打开服务器上的一个文本文件,返回的$myFile 就将成为这个文件操作的句柄,然后再通过循环指令,取出文件中每一行的内容并打印出来。
 
编程思路
 
首先要使用的函数为fi1e,本函数与 readfile() 类似,不同的地方为 file 函数将文件中的内容全部读出 ......

在PHP里加载mcrypt模块 Smilings

1.下载安装mcrypt
先去http://www.sourceforge.net下载Libmcrypt,mhash,mcrypt安装包
2 .先安装Libmcrypt
#tar -zxvf libmcrypt-2.5.8.tar.gz
#cd libmcrypt-2.5.8
#./configure
#make
#make install
说明:libmcript默认安装在/usr/local
3.安装mhash
#tar -zxvf mhash-0.9.9.9.tar.gz
#cd mhash-0.9.9.9
#./ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号