V
V
voloskov972015-08-22 21:36:26
Arrays
voloskov97, 2015-08-22 21:36:26

Two arrays, make up an integer. How?

Hello guys, there are two arrays, an example

[0] => array ( <- это сезоны
     [0] => 1
     [1] => 2
     [2] => 3
)
[0] => array ( <- это серии
     [0] => 1
     [1] => 2
     [2] => 3
)

The question is how to get the view to look like this
[0] => array (
     [0] => array (
          [id-сезона] => 1
          [id-серии] => 1
     )
     [1] => array (
          [id-сезона] => 2
          [id-серии] => 2
     )
     [2] => array (
          [id-сезона] => 3
          [id-серии] => 3
     )
)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Arman, 2015-08-22
@voloskov97

more or less like this:

<?php
$array1 = array(); // <- это сезоны
$array2 = array(); // <- это серии
$result = array();
foreach($array1 as $key => $value) {
$result[$key] = array(
    'id-сезона' => $array1[$key],
    'id-серии' => $array2[$key],
    );
}

echo '<pre>';
print_r($result);
echo '</pre>';
?>

V
voloskov97, 2015-08-22
@voloskov97

ATP what you need!)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question