-
PHP实现Huffman编码/解码的示例代码
[PHP教程] 2021-05-22 16:30:41 94人阅读
Huffman 编码是一种数据压缩算法。我们常用的 zip 压缩,其核心就是 Huffman 编码,还有在 HTTP/2 中,Huffman 编码被用于 HTTP 头部的压缩。 本文就来用 PHP 来实践一下 Huffman 编码和解码。 1. 编码 字数统计 Huf...[详细]
-
PHP排序算法之基数排序(Radix Sort)实例详解
[PHP教程] 2021-05-22 16:29:48 119人阅读
本篇章节讲解PHP排序算法之基数排序(Radix Sort)。供大家参考研究具体如下: 基数排序在《》中并未讲到,但是为了凑齐八大排序算法,我自己通过网络学习了这个排序算法,并给大家分享出来。 基本思想: 基数排序(ra...[详细]
-
PHP排序算法之堆排序(Heap Sort)实例详解
[PHP教程] 2021-05-22 16:28:57 189人阅读
本篇章节讲解PHP排序算法之堆排序(Heap Sort)。供大家参考研究具体如下: 算法引进: 在这里我直接引用《》里面的开头: 在前面讲到 ,它在待排序的 n 个记录中选择一个最小的记录需要比较 n - 1 次,本来这也可以理...[详细]
-
PHP排序算法之快速排序(Quick Sort)及其优化算
[PHP教程] 2021-05-22 16:27:34 103人阅读
本篇章节讲解PHP排序算法之快速排序(Quick Sort)及其优化算法。供大家参考研究具体如下: 基本思想: 快速排序(Quicksort)是对冒泡排序的一种改进。他的基本思想是:通过一趟排序将待排记录分割成独立的两部分,其...[详细]
-
PHP基于SPL实现的迭代器模式示例
[PHP教程] 2021-05-22 16:26:58 82人阅读
本篇章节讲解PHP基于SPL实现的迭代器模式。分享给大家供大家参考,具体如下: 现在有这么两个类,Department部门类、Employee员工类: _name = $name; $this->employees = array(); } function addEmployee(Employee...[详细]
-
PHP生成推广海报的方法分享
[PHP教程] 2021-05-22 16:26:19 108人阅读
经常有这样的需求,就是需要在生成推广海报,包含指定的二维码,分享出去别人扫码之后就可以确定用户推荐关系。 仔细分析一下,推广海报必要的要素就是海报背景图和二维码,这两者都容易生成,但要两者结合到一起组...[详细]
-
PHP排序算法之归并排序(Merging Sort)实例详解
[PHP教程] 2021-05-22 16:24:53 185人阅读
本篇章节讲解PHP排序算法之归并排序(Merging Sort)。供大家参考研究具体如下: 基本思想: 归并排序:就是利用归并(合并)的思想实现的排序方法。它的原理是假设初始序列含有 n 个元素,则可以看成是 n 个有序的子...[详细]
-
PHP操作Redis常用技巧总结
[PHP教程] 2021-05-22 16:24:14 79人阅读
本篇章节讲解PHP操作Redis常用技巧。供大家参考研究具体如下: 一、Redis连接与认证 connect('127.0.0.1...[详细]
-
PHP操作MongoDB实现增删改查功能【附php7操作Mo
[PHP教程] 2021-05-22 16:23:15 113人阅读
本篇章节讲解PHP操作MongoDB实现增删改查功能。供大家参考研究具体如下: MongoDB的PHP驱动提供了一些核心类来操作MongoDB,总的来说MongoDB命令行中有的功能,它都可以实现,而且参数的格式基本相似。PHP7以前的版...[详细]
-
PHP操作Postgresql封装类与应用完整实例
[PHP教程] 2021-05-22 16:22:48 83人阅读
本篇章节讲解PHP操作Postgresql封装类与应用。分享给大家供大家参考,具体如下: 这个类封装了一些常用的函数,原帖里面还有事务处理的内容,以后再学习吧。 类文件定义: host = $host;$this->port = $port;$this->...[详细]
- 这篇文章主要介绍了Laravel 5.0 发布 新版本特性详解,...[详细]
- 计算两个日期之间的时间差需要先把两个日期转换成纪元...[详细]
- 初步使用面向对象程序设计,要掌握的就是使用面向对象...[详细]
- 每个 PHP 数组内部都有一个指针,该指针指向数组的某...[详细]
- 因为 PHP 是一个 Web 编程语言,在编程过程中难免会遇...[详细]
- PHP 中提供了 return 语句来返回函数的运行结果,其语...[详细]
- final 关键字的作用如下: 使用 final 修饰的类,不能...[详细]
- 在使用 switch 语句时应该注意以下几点: 和 if 语句...[详细]
- 这篇文章主要给大家介绍了关于PHP替换Word中变量并导...[详细]
- 这篇文章主要介绍了PHP常量DIRECTORY_SEPARATOR原理及...[详细]