Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexchent committed Jan 14, 2020
1 parent 769ca19 commit e0631c4
Show file tree
Hide file tree
Showing 10 changed files with 208 additions and 153 deletions.
307 changes: 192 additions & 115 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Useredis.php → Cache/Redis.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
class Useredis{
class Redis{
const HOST="127.0.0.1";
const PORT="6379";
public $redis;
Expand Down
9 changes: 5 additions & 4 deletions Helper/cuttxt.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ function copyTxt($fileName){
}


/**将文件分割为$number份
* @param $fileName
* @param $number
/**
* 将文件分割为$number份
* @param string $fileName 文件
* @param int $number 分割份数
*/
public static function cutTXTbyNumber($fileName, $number= 2) {
public static function cutTXTbyNumber($fileName, int $number= 2) {

if(file_exists($fileName)){
$count = 1;
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ This is a PHP test
- [给定一个二维数组,数组每行从左到右都是递增的;每列也是递增的。
请完成一个函数,输入如上二维数组和一个整数,函数功能为判断该整数是都存在于数组中。
时间复杂度尽可能低。(请说明时间复杂度)](/suanfa/deep_in_array.php)

- [求一个矩阵中最大的二维矩阵(元素和最大) ](/suanfa/max_array.php)
- [输入一个字符串,输出所有排列](/suanfa/all_group.php)

## [laboratory 实验室](/laboratory)
- [测试 array_filter|array_walk|array_map](/laboratory/array_foreach.php)
- [写一个函数,尽可能高效的,从一个标准 url 里取出文件的扩展名](/laboratory/getUrlExtensionName.php)
- [求一个矩阵中最大的二维矩阵(元素和最大) ](/suanfa/max_array.php)

如:

Expand All @@ -26,4 +26,7 @@ This is a PHP test
4 5
5 3

- [php7新特性——标量类型与返回值类型声明、以及静态变量的作用域](laboratory/php7_1.php)
- [php7新特性——标量类型与返回值类型声明、以及静态变量的作用域](laboratory/php7_1.php)

## [Helper 辅助类小工具](/Helper)
- [裁剪分割文本文件](/Helper/cuttxt.php)
3 changes: 1 addition & 2 deletions getVideoTxt.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
include 'cli/pachong.php';


echo 111;die;

$redis = new Redis();
$redis->pconnect('127.0.0.1','6379');


//$res = $redis->sMembers('video_'.URL);
$res = $redis->sDiff('video_'.URL, 'video');//获取差集,key1为主体
//var_dump($res);die;
var_dump($res);die;
foreach ($res as $i){
file_put_contents("video1.txt", $i."\n",FILE_APPEND);
}
Expand Down
12 changes: 0 additions & 12 deletions strpad.php

This file was deleted.

4 changes: 2 additions & 2 deletions all_group.php → suanfa/all_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
*
*/

$str = 'abcd';
$str = 'abc';
test3(str_split($str), 0, strlen($str)-1);


function test3(&$arr,$start,$len){

if ($start== $len){
echo join('', $arr),PHP_EOL; //④
echo implode('', $arr),PHP_EOL; //④
}else {

for ($i = $start; $i <= $len; $i++) {
Expand Down
12 changes: 0 additions & 12 deletions subday.php

This file was deleted.

1 change: 0 additions & 1 deletion test.js

This file was deleted.

2 changes: 1 addition & 1 deletion test.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php/** * Created by PhpStorm. * User: chentao * Date: 2019/12/5 * Time: 11:02 AM *///declare(strict_types=0);require "/Users/chentao/Documents/work/interview/Helper/cuttxt.php";cutTXT::cutTXTbyNumber(__DIR__."/test.txt", 2);die;$redis = new Redis();$redis->connect('127.0.0.1',3306);die;class A { private $x = 1;}// PHP 7 之前版本定义闭包函数代码$getXCB = function() { return $this->x;};// 闭包函数绑定到类 A 上//$getX = $getXCB->bindTo(new A, 'A');//echo $getX();//print(PHP_EOL);echo $getXCB->call(new A, 'A');
<?php/** * Created by PhpStorm. * User: chentao * Date: 2019/12/5 * Time: 11:02 AM */class A { private $x = 1;}// PHP 7 之前版本定义闭包函数代码$getXCB = function() { return $this->x;};// 闭包函数绑定到类 A 上//$getX = $getXCB->bindTo(new A, 'A');//echo $getX();//print(PHP_EOL);echo $getXCB->call(new A, 'A');
Expand Down

0 comments on commit e0631c4

Please sign in to comment.