php基础知识点列表【2020年10月7日】

2020年10月7日

1》获取项目入口路径
$BASE_PATH = str_replace('\','/',str_replace('index.php',__FILE__));

2》 file_get_contents 追加文件记录信息
file_get_contents('scan_log.txt',$fileName.PHP_EOL,FILE_APPEND);
 
3》统计数组中重复次数最多的值
$cv = array_count_values($data);
// $cv = [6 => 2, 11 => 4, 2 => 2, 4 => 3, 7 => 1, 8 => 1]
arsort($cv);
$max = key($cv);
 
 4》判断是否为一维数组
count($array) == count($array, 1) 使用count 的第二个参数进行数据遍历
 
compact 创建一个包含变量名和它们的值的数组:
value($arr,'select_value') 获取arr中已select_value 为索引的数值
getchwd() 函数返回当前工作目录
filemtime() 函数返回文件内容上次的修改时间
array_change_key_case() 函数将数组的所有的键都转换为大写字母或小写字母
php_strip_whitespace() 函数返回已删除 PHP 注释以及空白字符的源代码文件。
parse_str() 函数把查询字符串解析到变量中。
array_walk_recursive() 函数对数组中的每个元素应用用户自定义函数
number_format() 去除逗号的方法 【number_format($num,2,'.',''); // 使用第四个参数,设置逗号格式为空】
array_change_key_case() 函数 将数组的所有的键转换为大写字母

原文地址:https://www.cnblogs.com/sien6/p/13779375.html