如何在PHP中分解多位数的整数数组

This is my array:

Array ( 
        [0] => 880 
        [1] => 556 
      )

Is there any possible way to breakdown like these?

Array ( 
        [0] => 8 
        [1] => 8 
        [2] => 0 
        [3] => 5 
        [4] => 5 
        [5] => 6
      )

Simply use str_split() with implode()

<?php

$array = Array ( 0 => 880, 1 => 556 );
$finalArray = str_split( implode( '', $array ) );

print_r( $finalArray );

Output:- https://3v4l.org/2AIpm

Reference:

str_split()

implode()

Try this code:

$array = [0 => 880, 1 => 556];
$data = [];
foreach ($array as $a) {
    $var = str_split($a);
    foreach ($var as $v) {
        $data[] = $v;
    }
}

implode — Join array elements with a string

#str_split — Convert a string to an array

Using implode and str_split you can do this. Below the code for step by step reference.

<?php

$array = array(880,556); // array
$stringVersion = implode("", $array); //Implode array like. 880556.
$arr1 = str_split($stringVersion ); // str_split — Convert a string to an array
echo "<pre>";
print_r($arr1);
?>

Output:

Array
(
    [0] => 8
    [1] => 8
    [2] => 0
    [3] => 5
    [4] => 5
    [5] => 6
)

Yes you can do

$oldArray = array(880, 556);
$newArray = [];

foreach ($oldArray as $value)
{
    $value = (string)$value; //casting to string to have more control on each number
    for($i = 0; $i < strlen($value); $i++)
        $newArray.push((int)$value[$i]); //casting back to int
}

In that case i assume all values will be integer and not negative.

You can use str_split and implode

$data = [880,556];
$arr = str_split(implode('',$data));

$arr = [ 880, 556 ];
$newArr = [];

foreach($arr as $value) {
  foreach(str_split($value) as $newValue) {
    $newArr[] = $newValue;
  }
}

print_r($newArr);