Home > Q&A > body text
请问用哪个函数将下面的字符串截取后面两项并转换为数组?<?php
$week = "Monday,Tuesday,Wednesay,Thursday,Friday,Saturday,Sunday";
?>
ringa_lee2017-04-10 16:15:38
$result = array_splice( explode(',', $week), -2 ); var_dump($result);
PHPz2017-04-10 16:15:38
先分割成数组 然后用array_splice取数组的后两个元素
大家讲道理2017-04-10 16:15:38
split(分割符):根据分割字符,把字符串拆分成数组
Home
Course
Q&A
My