fork download
  1. <?php
  2.  
  3. $array = array('s00473276\Soul To Squeeze\Red Hot Chili Peppers',
  4. 't00034422\Soul To Squeeze\Red Hot Chili Peppers',
  5. '209676\Soul To Squeeze\Red Hot Chili Peppers',
  6. 's00473331\What Is Soul ?\Red Hot Chili Peppers',
  7. '209672\Show Me Your Soul\Red Hot Chili Peppers',
  8. 't00034415\Show Me Your Soul\Red Hot Chili Peppers',
  9. 's00473268\Show Me Your Soul\Red Hot Chili Peppers',
  10. );
  11.  
  12. function myFunc($item) {
  13. $parts = explode('\\', $item, 2);
  14.  
  15. return $parts[0];
  16. }
  17.  
  18. $newArray = array_map('myFunc', $array);
  19.  
  20. print_r($newArray);
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
Array
(
    [0] => s00473276
    [1] => t00034422
    [2] => 209676
    [3] => s00473331
    [4] => 209672
    [5] => t00034415
    [6] => s00473268
)