社区
基础编程
帖子详情
preg_match_all和array_slice是什么函数??在哪能查到这些函数的用法??
kxyes
2003-09-11 03:52:29
如题
...全文
42
2
打赏
收藏
preg_match_all和array_slice是什么函数??在哪能查到这些函数的用法??
如题
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
1fairy1
2003-09-11
打赏
举报
回复
preg_match_all
字符串整体比对解析。
语法: int preg_match_all(string pattern, string subject, array matches, int [order]);
返回值: 整数
函数种类: 资料处理
内容说明
本函数以 pattern 的规则来整体解析比对字符串 subject。比对结果返回的值放在数组参数 matches 之中,并依顺序值 order 排序。参数 order 的值有 PREG_PATTERN_ORDER 及 PREG_SET_ORDER 二种。若没有 order 值,则系统自动以 PREG_PATTERN_ORDER 代入 order 值中。返回值为合乎比对结果的数目,若没有或错误则返回 false 值。
使用范例
PREG_PATTERN_ORDER 的例子
<?php
preg_match_all("|<[^>]+>(.*)</[^>]+>|U", "<div align=left>a test</div>", $out, PREG_PATTERN_ORDER);
print $out[0][0].", ".$out[0][1]."\n";
print $out[1][0].", ".$out[1][1]."\n"
?>
返回值为
<b>example: </b>, <div align=left>this is a test</div>
example: , this is a test
PREG_SET_ORDER 的例子
<?php
preg_match_all("|<[^>]+>(.*)</[^>]+>|U", "<div align=left>a test</div>", $out, PREG_SET_ORDER);
print $out[0][0].", ".$out[0][1]."\n";
print $out[1][0].", ".$out[1][1]."\n"
?>
返回值为
<b>example: </b>, example:
<div align=left>this is a test</div>, this is a test
______________________________________________________________________________
xuzuning
2003-09-11
打赏
举报
回复
手册上都有
preg_match_all与preg_match相似
array_slice与substr相似,只是前者是对数组操作
php无参数
函数
实现rce,浅谈无参数RCE
0x00 前言这几天做了几道无参数RCE的题目,这里来总结一下,以后忘了也方便再捡起来。首先先来解释一下什么是无参数RCE:形式:if(';' === preg_replace('/[^W]+((?R)?)/', '', $_GET['code'])) { eval($_GET['code']);}preg_replace('/[a-z]+((?R)?)/', NULL, $code)pre_ma...
php 字符串截取 preg_relpace
array
,php中文字符串截取多种方法汇总
1. 截取GB2312中文字符串< ?php//截取中文字符串function mysubstr($str, $start, $len) {$tmpstr = "";$strlen = $start + $len;for($i = 0; $i < $strlen; $i++) {if(ord(substr($str, $i, 1)) > 0xa0) {$tmpstr .= sub...
PHP常用
函数
打包
常用
函数
打包,持续更新。。 - /* * php正则出url所有参数 * 支持 ?、$、# * */ public function getUrlKeyValue($url){ $result =
array
(); $mr = preg_
match
_all('/(\?|&|#)(.+?)=([^&am...
常用PHP
函数
http://document.thinkphp.cn/manual_3_2.html tp3.23 手册 https://www.kancloud.cn/manual/thinkphp5/154295 tp5.0 手册 https://chuanke.baidu.com/v1253098-100718-168965.html php教学视频 http://www...
做项目可能用到的
函数
函数
函数
函数
函数
函数
函数
函数
函数
函数
函数
函数
函数
函数
preg_
match
,number_format,function_exists,str_repeat,
array
_pop,
array
_unique,
array
_merge,preg_replace,crc32 —————————————————————————————
基础编程
21,886
社区成员
140,364
社区内容
发帖
与我相关
我的任务
基础编程
从PHP安装配置,PHP入门,PHP基础到PHP应用
复制链接
扫一扫
分享
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章