PHP:将逗号分隔值转换为整数数组

I've got a string of comma separated values: 1,2,3,4,5,6,7,8,9,10,11,12,13

How can I get rid of the comma, turn each value into an integer and end up with a PHP array of these numbers?

$number_array = [1, 2, 3, 4 ....., 13]; - something like that?

Make use of explode()

<?php
$str='1,2,3,4,5,6,7,8,9,10,11,12,13';
$arr = explode(',',$str);
$intarr = array_map('intval',$arr);
var_dump($intarr);

Well, a one-liner.

var_dump(array_map('intval',explode(',','1,2,3,4,5,6,7,8,9,10,11,12,13')));

OUTPUT :

array(13) {
  [0]=>
  int(1)
  [1]=>
  int(2)
  .
  .   // Lines Skipped
  .
  int(12)
  [12]=>
  int(13)
}