有人可以解释如何使用php preg_match
将字符串从字符串的开头到第一个反斜杠分解成一个数组吗?
我有一个数组:
(
[0] => s00473276\Soul To Squeeze\Red Hot Chili Peppers
[1] => t00034422\Soul To Squeeze\Red Hot Chili Peppers
[2] => 209676\Soul To Squeeze\Red Hot Chili Peppers
[3] => s00473331\What Is Soul ?\Red Hot Chili Peppers
[4] => 209672\Show Me Your Soul\Red Hot Chili Peppers
[5] => t00034415\Show Me Your Soul\Red Hot Chili Peppers
[6] => s00473268\Show Me Your Soul\Red Hot Chili Peppers
[7] => s00473233\Out Of Range By Red Hot Chili Peppers\Red Hot Chili Peppers
[8] => 209603\Get On Top\Red Hot Chili Peppers
[9] => t00034374\I've Been Down\Red Hot Chili Peppers
)
我想创建另一个数组,这样我就可以了
[0] => s00473276
[1] => t00034422 etc...
最佳答案
$new_array = array();
foreach($your_array as $element)
list($new_array[]) = explode('\\', $element);
print_r($new_array);