Table of Contents
回复讨论(解决方案)
Home Backend Development PHP Tutorial 又一个php正则表达式的问题 匹配文本成二维数组 分数给力

又一个php正则表达式的问题 匹配文本成二维数组 分数给力

Jun 23, 2016 pm 02:18 PM

查询结果如下: 该交通违法有记录! 信息来源: 非现场记录 文书号/决定书号/文书编号: 未裁决,无 车牌号码: 粤K32889 车主名称: 号牌种类: 违法时间: 2011-02-08 15:21:52.0 违法地点: 省道高铜线台山市斗山镇路段 采集机关: 台山市公安局交通警察大队斗山中队 所在地市: 违法行为名称: 机动车行驶超过规定时速50%以下的 处理地点: 台山市台城缠溪松山咀 处理地点联系电话: 0750-5520011 信息来源: 非现场记录 文书号/决定书号/文书编号: 未裁决,无 车牌号码: 粤K32889 车主名称: 号牌种类: 违法时间: 2010-10-25 07:12:57.0 违法地点: 东莞市长安镇莱茵阁路口(固定电子警察) 采集机关: 东莞市公安局交通警察支队长安大队 所在地市: 违法行为名称: 机动车通过有灯控路口时,不按所需行进方向驶入导向车道的 处理地点: 东莞市长安镇大板地工业大道1号 处理地点联系电话: 0769-81661611 信息来源: 非现场记录 文书号/决定书号/文书编号: 未裁决,无 车牌号码: 粤K32889 车主名称: 号牌种类: 违法时间: 2010-12-29 20:34:39.0 违法地点: 振安夏边路口(东-西) 采集机关: 东莞市公安局交通警察支队长安大队 所在地市: 违法行为名称: 机动车通过有灯控路口时,不按所需行进方向驶入导向车道的 处理地点: 东莞市长安镇大板地工业大道1号 处理地点联系电话: 0769-81661611 设为首页 | 加入收藏 | 联系方法 | 网站地图 | 友情链接 | 版权声明 版权所有 2006 广东省公安厅交通管理局政务服务网 ePRO易宝电脑系统(广州)有限公司提供技术支持 未经许可不得转载及建立镜像 否则追究法律责任
Copy after login

这是源文档,我想用php的正则表达式最终得到如下结果
$array[0][0]=非现场记录$array[0][1]=2011-02-08 15:21:52.0$array[0][2]=省道高铜线台山市斗山镇路段$array[0][3]=台山市公安局交通警察大队斗山中队$array[0][4]=机动车行驶超过规定时速50%以下的$array[0][5]=台山市台城缠溪松山咀$array[1][0]=非现场记录$array[1][1]=2010-10-25 07:12:57.0..............................................................$array[2][5]=东莞市长安镇大板地工业大道1号
Copy after login


非常感谢大家


回复讨论(解决方案)

随便写了下,测试效果初步出来了。只是还有所欠缺,只当抛砖引玉吧

([\S|/]+:\s)([\S]+)
Copy after login

$str = <<<str查询结果如下: 该交通违法有记录! 信息来源: 非现场记录 文书号/决定书号/文书编号: 未裁决,无 车牌号码: 粤K32889 车主名称: 号牌种类: 违法时间: 2011-02-08 15:21:52.0 违法地点: 省道高铜线台山市斗山镇路段 采集机关: 台山市公安局交通警察大队斗山中队 所在地市: 违法行为名称: 机动车行驶超过规定时速50%以下的 处理地点: 台山市台城缠溪松山咀 处理地点联系电话: 0750-5520011 信息来源: 非现场记录 文书号/决定书号/文书编号: 未裁决,无 车牌号码: 粤K32889 车主名称: 号牌种类: 违法时间: 2010-10-25 07:12:57.0 违法地点: 东莞市长安镇莱茵阁路口(固定电子警察) 采集机关: 东莞市公安局交通警察支队长安大队 所在地市: 违法行为名称: 机动车通过有灯控路口时,不按所需行进方向驶入导向车道的 处理地点: 东莞市长安镇大板地工业大道1号 处理地点联系电话: 0769-81661611 信息来源: 非现场记录 文书号/决定书号/文书编号: 未裁决,无 车牌号码: 粤K32889 车主名称: 号牌种类: 违法时间: 2010-12-29 20:34:39.0 违法地点: 振安夏边路口(东-西) 采集机关: 东莞市公安局交通警察支队长安大队 所在地市: 违法行为名称: 机动车通过有灯控路口时,不按所需行进方向驶入导向车道的 处理地点: 东莞市长安镇大板地工业大道1号 处理地点联系电话: 0769-81661611 设为首页 | 加入收藏 | 联系方法 | 网站地图 | 友情链接 | 版权声明 版权所有 2006 广东省公安厅交通管理局政务服务网 ePRO易宝电脑系统(广州)有限公司提供技术支持 未经许可不得转载及建立镜像 否则追究法律责任str;preg_match_all('/				信息来源				:\s(.+)\s.+				#来源#				:\s([\d \-\.:]+\.0).+	#时间#				:\s(.+)\s.+				#地点#				:\s(.+)\s.+				#采集机关#				:.+:								\s(.+)\s.+				#违法行为名称#				\s(.+)\s.+				#处理地点#				\d{4}\-\d{5,}					/Usx', $str, $matches);$res = array();for ($i = 0; $i < count($matches[1]); $i++){	for ($j = 1; $j <= 6; $j++){		$res[$i][] = $matches[$j][$i];	}}echo '<pre class="brush:php;toolbar:false">';print_r($res);echo '
Copy after login
';/** *Array( [0] => Array ( [0] => 非现场记录 [1] => 2011-02-08 15:21:52.0 [2] => 省道高铜线台山市斗山镇路段 [3] => 台山市公安局交通警察大队斗山中队 [4] => 机动车行驶超过规定时速50%以下的 [5] => 台山市台城缠溪松山咀 ) [1] => Array ( [0] => 非现场记录 [1] => 2010-10-25 07:12:57.0 [2] => 东莞市长安镇莱茵阁路口(固定电子警察) [3] => 东莞市公安局交通警察支队长安大队 [4] => 机动车通过有灯控路口时,不按所需行进方向驶入导向车道的 [5] => 东莞市长安镇大板地工业大道1号 ) [2] => Array ( [0] => 非现场记录 [1] => 2010-12-29 20:34:39.0 [2] => 振安夏边路口(东-西) [3] => 东莞市公安局交通警察支队长安大队 [4] => 机动车通过有灯控路口时,不按所需行进方向驶入导向车道的 [5] => 东莞市长安镇大板地工业大道1号 )) **/够无聊,还不如直接截取字符串.

PHP code

$str = << 查询结果如下: 该交通违法有记录! 信息来源: 非现场记录 文书号/决定书号/文书编号: 未裁决,无 车牌号码: 粤K32889 车主名称: 号牌种类: 违法时间: 2011-02-08 15:21:52.0 违法地点: 省道高铜线台山市斗山镇路段 采集机关: 台山市公安局交通警察大队斗山中队 所在地市: 违法行为名称: 机动车行驶超过规定时速5……

ZT_King是正则达人,受教了,学习了

牛人阿

PHP code

$str = << 查询结果如下: 该交通违法有记录! 信息来源: 非现场记录 文书号/决定书号/文书编号: 未裁决,无 车牌号码: 粤K32889 车主名称: 号牌种类: 违法时间: 2011-02-08 15:21:52.0 违法地点: 省道高铜线台山市斗山镇路段 采集机关: 台山市公安局交通警察大队斗山中队 所在地市: 违法行为名称: 机动车行驶超过规定时速5……

ZT_King 怎么截取啊?Google了1天没找到,正则搞的我头大

$str = <<<str......str;
Copy after login

这个是什么意思
我的源码保存在一个变量$b里 怎么用啊
$str=$b; 这样不可以 应该怎么用

<< data
NAME
表示原文档,你可以认为是单双引号,是用来做示例文档的.可以在data间放入自己的内容.
如果$str=$b后还不能用,那就是$b内容的编码问题了,可以试试$str = iconv('gbk','utf8',$b);

转码还是不行 $b是多行的内容.是不是应该改一下正则表达式来匹配多行.应该怎么改啊

非常感谢

<< data
NAME
表示原文档,你可以认为是单双引号,是用来做示例文档的.可以在data间放入自己的内容.
如果$str=$b后还不能用,那就是$b内容的编码问题了,可以试试$str = iconv('gbk','utf8',$b);

已经是全部数据匹配了,刚检查了下,循环出错了,测试数据刚好取了6条,所以没发现.下面已改正
数据不正常,你应该多检查下编码.

for ($i = 0; $i < count($matches[0]); $i++){
Copy after login

插入加红没起作用,第一个循环用$matches[0]做限制.

插入加红没起作用,第一个循环用$matches[0]做限制.
问题好像不是出在这里,而是在匹配多行上的问题

$str = <<<str=!信息来源:  非现场记录文书号/决定书号/文书编号:  未裁决,无车牌号码:  粤K32889车主名称:  号牌种类:  违法时间:  2011-02-08 15:21:52.0违法地点:  省道高铜线台山市斗山镇路段采集机关:  台山市公安局交通警察大队斗山中队所在地市:  违法行为名称:  机动车行驶超过规定时速50%以下的处理地点:  台山市台城缠溪松山咀处理地点联系电话:  0750-5520011信息来源:  非现场记录文书号/决定书号/文书编号:  未裁决,无车牌号码:  粤K32889车主名称:  号牌种类:  违法时间:  2010-10-25 07:12:57.0违法地点:  东莞市长安镇莱茵阁路口(固定电子警察)采集机关:  东莞市公安局交通警察支队长安大队所在地市:  违法行为名称:  机动车通过有灯控路口时,不按所需行进方向驶入导向车道的处理地点:  东莞市长安镇大板地工业大道1号处理地点联系电话:  0769-81661611信息来源:  非现场记录文书号/决定书号/文书编号:  未裁决,无车牌号码:  粤K32889车主名称:  号牌种类:  违法时间:  2010-12-29 20:34:39.0违法地点:  振安夏边路口(东-西)采集机关:  东莞市公安局交通警察支队长安大队所在地市:  违法行为名称:  机动车通过有灯控路口时,不按所需行进方向驶入导向车道的处理地点:  东莞市长安镇大板地工业大道1号处理地点联系电话:  0769-81661611 设为首页 | 加入收藏 | 联系方法 | 网站地图 | 友情链接 | 版权声明版权所有 2006 广东省公安厅交通管理局政务服务网ePRO易宝电脑系统(广州)有限公司提供技术支持未经许可不得转载及建立镜像 否则追究法律责任str;
Copy after login


这样就没法匹配成功了

可以把所有的\n去掉然后匹配。
str_replace();

错,应该是

那多一个工序,直接改匹配算法不行吗
改这个

preg_match_all('/                信息来源                :\s(.+)\s.+                #来源#                :\s([\d \-\.:]+\.0).+    #时间#                :\s(.+)\s.+                #地点#                :\s(.+)\s.+                #采集机关#                :.+:                                \s(.+)\s.+                #违法行为名称#                \s(.+)\s.+                #处理地点#                \d{4}\-\d{5,}                    /Usx', $str, $matches);
Copy after login


错,应该是


$str = <<';print_r($res);echo '
Copy after login
';/** * Array( [0] => Array ( [0] => 非现场记录 [1] => 2011-02-08 15:21:52.0 [2] => 省道高铜线台山市斗山镇路段 [3] => 台山市公安局交通警察大队斗山中队 [4] => 机动车行驶超过规定时速50%以下的 [5] => 台山市台城缠溪松山咀 ) [1] => Array ( [0] => 非现场记录 [1] => 2010-10-25 07:12:57.0 [2] => 东莞市长安镇莱茵阁路口(固定电子警察) [3] => 东莞市公安局交通警察支队长安大队 [4] => 机动车通过有灯控路口时,不按所需行进方向驶入导向车道的 [5] => 东莞市长安镇大板地工业大道1号 ) [2] => Array ( [0] => 非现场记录 [1] => 2010-12-29 20:34:39.0 [2] => 振安夏边路口(东-西) [3] => 东莞市公安局交通警察支队长安大队 [4] => 机动车通过有灯控路口时,不按所需行进方向驶入导向车道的 [5] => 东莞市长安镇大板地工业大道1号 )) * */

PHP code
……
假设

表单内容是

<form  method="post" action="http://www.gdgajj.com/cx/wzss/wzss.do" >	名字:		<input name='jc' type='text' value='粤' style='width:20'>	验证码:   <input type='text' name='randcode2' size='5' value=''>	<img  src="/static/imghw/default1.png"  data-src="http://www.gdgajj.com/cx/servlet/ImageServlet"  class="lazy"    alt="又一个php正则表达式的问题 匹配文本成二维数组 分数给力" >	<input name='image2' type='submit'></form>
Copy after login


识别验证码的模块是
$img="a.jpg" //当前目录下的验证码图片名字include ('Valite.php');$valite = new Valite();$valite->setImage($img);$valite->getHec();$ert = $valite->run();//$ert就是识别出来的数字
Copy after login


提交表单我用snoopy

include "Snoopy.class.php";	$snoopy = new Snoopy;	$submit_url = "http://www.gdgajj.com/cx/wzss/wzss.do";	$submit_vars["jc"] = "amiga";	$submit_vars["randcode2"] = $ert;	$snoopy->submittext($submit_url,$submit_vars);
Copy after login


现在的问题是:我如何获取验证码

$snoopy->fetch("http://www.gdgajj.com/cx/servlet/ImageServlet");
Copy after login

还是用什么,已确保获取验证码的时候,他们服务器的session已经记录了.
如何把我发的这几段代码链接起来.
"识别验证码的模块"和"模拟提交表单的模块"怎样结合起来?

$im = imagecreatefromjpeg('http://www.gdgajj.com/cx/servlet/ImageServlet');imagejpeg($im, 'a.jpg');//这样保存图片,然后用那个程序解析出数字,再然后用snoopy提交
Copy after login

请问这样一个字符串$str

$str='[0,"通信与信息工程学院","","","","",3,"","","",-1,2,"通信工程","","","",3,"","pubStuKebiao.php?zyh=0101","frameList",2,
"电子信息工程","","","",3,"","pubStuKebiao.php?zyh=0102","frameList",2,"电子信息科学与技术","","","",3,"","pubStuKebiao.php?
zyh=0103","frameList",2,"信息工程","","","",3,"","pubStuKebiao.php?zyh=0104","frameList",2,"广播电视工程","","","",3,"","pubS
tuKebiao.php?zyh=0105","frameList",2,"通信与信息类","","","",3,"","pubStuKebiao.php?zyh=0114","frameList",2,"通信与信息类实验
班","","","",3,"","pubStuKebiao.php?zyh=0118","frameList",2,"通信学院卓越班","","","",3,"","pubStuKebiao.php?zyh=0190","frameList"
,2,"通信学院IT精英班","","","",3,"","pubStuKebiao.php?zyh=0191","frameList",2,"通信工程国际实验班","","","",3,"","pubStuKebiao.php
?zyh=0192","frameList",2,"电子信息工程(通信技术方向)","","","",3,"","pubStuKebiao.php?zyh=2003","frameList",2,"电子信息工程(通信技
术)","","","",3,"","pubStuKebiao.php?zyh=5101","frameList",2,"电子信息工程(应用电子技术)","","","",3,"","pubStuKebiao.php?zyh=5102","
frameList",2,"电子信息工程类(实验班)","","","",3,"","pubStuKebiao.php?zyh=5109","frameList",1,0,"光电工程学院","","","","",3,"","",""
,-1,2,"光信息科学与技术","","","",3,"","pubStuKebiao.php?zyh=0201","frameList",2,"微电子学","","","",3,"","pubStuKebiao.php?zyh=0202"
,"frameList",2,"电子科学与技术","","","",3,"","pubStuKebiao.php?zyh=0203","frameList",2,"电子工程类","","","",3,"","pubStuKebiao.php
?zyh=0211","frameList",2,"微电子工程实验班","","","",3,"","pubStuKebiao.php?zyh=0219","frameList",1,0,"经济管理学院","","","","",3,
"","","",-1,2,"信息管理与信息系统","","","",3,"","pubStuKebiao.php?zyh=0301","frameList",2,"会计学","","","",3,"","pubStuKebiao.php
?zyh=0302","frameList",2,"经济学","","","",3,"","pubStuKebiao.php?zyh=0303","frameList",2,"市场营销","","","",3,"","pubStuKebiao.ph
p?zyh=0304","frameList",2,"工商管理","","","",3,"","pubStuKebiao.php?zyh=0305","frameList",2,"电子商务","","","",3,"","pubStuKebiao
.php?zyh=0306","frameList",2,"工程管理","","","",3,"","pubStuKebiao.php?zyh=0308","frameList",2,"信息管理类","","","",3,"","pubStuK
ebiao.php?zyh=0311","frameList",2,"工商管理类","","","",3,"","pubStuKebiao.php?zyh=0312","frameList",2,"国际化会计人才培养实验班","
","","",3,"","pubStuKebiao.php?zyh=0318","frameList",2,"工商管理类实验班","","","",3,"","pubStuKebiao.php?zyh=0390","frameList",2,"
经济学实验班","","","",3,"","pubStuKebiao.php?zyh=0391","frameList",2,"市场营销(企业营销与管理方向)","","","",3,"","pubStuKebiao.
php?zyh=2004","frameList",2,"信息管理与信息系统","","","",3,"","pubStuKebiao.php?zyh=2009","frameList",1,0,"计算机科学与技术学院","
","","","",3,"","","",-1,2,"计算机科学与技术","","","",3,"","pubStuKebiao.php?zyh=0401","frameList",2,"地理信息系统","","","",3,"",
"pubStuKebiao.php?zyh=0402","frameList",2,"网络工程","","","",3,"","pubStuKebiao.php?zyh=0403","frameList",2,"信息安全","","","",3,
"","pubStuKebiao.php?zyh=0404","frameList",2,"智能科学与技术","","","",3,"","pubStuKebiao.php?zyh=0405","frameList",2,"计算机与智能
科学类","","","",3,"","pubStuKebiao.php?zyh=0412","frameList",2,"计算机与智能科学类实验班","","","",3,"","pubStuKebiao.php?zyh=0418
","frameList",2,"计算机学院卓越班","","","",3,"","pubStuKebiao.php?zyh=0491","frameList",2,"计算机科学与技术","","","",3,"","pubStu
Kebiao.php?zyh=2001","frameList",2,"计算机科学与技术(计算机应用)","","","",3,"","pubStuKebiao.php?zyh=5301","frameList",2,"计算机科
学与技术(网络技术)","","","",3,"","pubStuKebiao.php?zyh=5302","frameList",2,"计算机科学与技术(信息安全)","","","",3,"","pubStuKebi
ao.php?zyh=5303","frameList",2,"计算机科学与技术类(实验班)","","","",3,"","pubStuKebiao.php?zyh=5309","frameList",1,0,"外国语学院"
,"","","","",3,"","","",-1,2,"英语","","","",3,"","pubStuKebiao.php?zyh=0501","frameList",2,"英语(商贸)","","","",3,"","pubStuKebia
.php?zyh=5401","frameList",1,0,"生物信息学院","","","","",3,"","","",-1,2,"生物医学工程","","","",3,"","pubStuKebiao.php?zyh=0601","
frameList",2,"生物技术","","","",3,"","pubStuKebiao.php?zyh=0602","frameList",2,"中药学","","","",3,"","pubStuKebiao.php?zyh=0603","
frameList",2,"制药工程","","","",3,"","pubStuKebiao.php?zyh=0604","frameList",2,"生物信息学","","","",3,"","pubStuKebiao.php?zyh=060
5","frameList",2,"生物技术与制药类","","","",3,"","pubStuKebiao.php?zyh=0611","frameList",2,"生物技术(生物信息学方向)","","","",3,
"","pubStuKebiao.php?zyh=0615","frameList",2,"生物与制药类实验班","","","",3,"","pubStuKebiao.php?zyh=0690","frameList",1,0,"法学院",
"","","","",3,"","","",-1,2]';



正则怎样写能达到这样的二维数组

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1269
29
C# Tutorial
1248
24
PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1? Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1? Apr 17, 2025 am 12:06 AM

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values ​​to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

How does PHP type hinting work, including scalar types, return types, union types, and nullable types? How does PHP type hinting work, including scalar types, return types, union types, and nullable types? Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

The Enduring Relevance of PHP: Is It Still Alive? The Enduring Relevance of PHP: Is It Still Alive? Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP vs. Python: Understanding the Differences PHP vs. Python: Understanding the Differences Apr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

PHP and Python: Code Examples and Comparison PHP and Python: Code Examples and Comparison Apr 15, 2025 am 12:07 AM

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

See all articles