[英]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.