PHP拆分问题
我尝试使用preg_split()和split()。以下是尝试和输出PHP拆分问题,php,split,preg-split,Php,Split,Preg Split,我尝试使用preg_split()和split()。以下是尝试和输出 preg_split("^", "ItemOne^ItemTwo^Item.Three^"); //output - null or false when attempting to implode() it. preg_split("\^", "ItemOne^ItemTwo^Item.Three^"); //output - null or false when attempting to implode() it. At
preg_split("^", "ItemOne^ItemTwo^Item.Three^");
//output - null or false when attempting to implode() it.
preg_split("\^", "ItemOne^ItemTwo^Item.Three^");
//output - null or false when attempting to implode() it. Attempted to escape the needle.
//SAME THING WITH split().
谢谢你的帮助。。。
克里斯蒂安·斯图尔特(Christian Stewart)不赞成拆分。您应该使用
explode
$arr=explode(“^”,“ItemOne^ItemTwo^Item.Three^”)代码>拆分
已被弃用。您应该使用explode
$arr=explode(“^”,“ItemOne^ItemTwo^Item.Three^”)代码>试试看
explode("^", "ItemOne^ItemTwo^Item.Three^");
因为您的搜索模式不是正则表达式。试试看
explode("^", "ItemOne^ItemTwo^Item.Three^");
因为你的搜索模式不是正则表达式。你确定你不仅仅在寻找explode
explode(“^”、“ItemOne^itemstwo^Item.Three^”)代码>你确定你不仅仅是在寻找爆炸
explode(“^”、“ItemOne^itemstwo^Item.Three^”)
由于您使用的是preg\u split
,因此您试图按给定的规则表达式拆分字符串。扬抑符(^)是正则表达式元字符,因此在您的示例中不起作用
顺便说一句:preg_split是split的一种替代方法,不推荐使用。因为您使用的是preg_split
,所以您试图按给定的正则表达式拆分字符串。扬抑符(^)是正则表达式元字符,因此在您的示例中不起作用
顺便说一句:preg_split是split的一种替代方案,不推荐使用