Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php中使用句点作为分隔符_Php - Fatal编程技术网

在php中使用句点作为分隔符

在php中使用句点作为分隔符,php,Php,说我有第一个,最后一个,或者鲍勃,迪伦 我能把它拆开吗 所以我有$first和$last 所以第一个变量是Bob。 最后一个变量是迪伦 我在想php split,但它已被弃用。使用explode',$var您可以改为使用。尝试使用with list 注意:$string包含一个。否则你会出错。您可以通过strpos检查它是否正确 另外,当尝试为不推荐使用的函数查找替代函数时,最好从不推荐使用的函数的“还请参见”函数列表开始。在本例中,explode在该列表中。更明确 list($first,$l

说我有第一个,最后一个,或者鲍勃,迪伦

我能把它拆开吗

所以我有$first和$last

所以第一个变量是Bob。 最后一个变量是迪伦

我在想php split,但它已被弃用。

使用explode',$var

您可以改为使用。

尝试使用with list

注意:$string包含一个。否则你会出错。您可以通过strpos检查它是否正确

另外,当尝试为不推荐使用的函数查找替代函数时,最好从不推荐使用的函数的“还请参见”函数列表开始。在本例中,explode在该列表中。

更明确

list($first,$last) = explode('.', $string, 2);

您可能希望将第三个可选参数$limit添加到explode调用中,以便在遇到first.middle.last时,不会丢失数据。。。列出$first,$last=explode',$name,2;谢谢我得到了“$fullname=explode.”,$username;$first=$fullname[0];$last=$fullname[1]`
list($first,$last) = explode('.', $string, 2);