繁体   English   中英

按php中其他字符串的长度连续拆分字符串?

[英]split string consecutively by the length of other string in php?

如何根据第二个变量的长度拆分下面的第一个文本变量

$text = "hey how are you";
$text1 = "how are you";
$length = strlen($text);
$length1 = strlen($text1);

使用str_split

$text = "hey how are you";
$text1 = "how are you";
$length = strlen($text);
$length1 = strlen($text1);
$parts = str_split($text, $length1); 
// Array([0] => hey how are [1] =>  you)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM