两个阵列组合或翻转

I have this two arrays:

array:4 [▼
  0 => 518
  1 => 519
  2 => 520
  3 => 521
]

and this one:

array:4 [▼
  0 => "1"
  1 => "2"
  2 => "3"
  3 => "3"
]

Can someone please help me how to achieve like this..

array:4 [▼
 518=>1
  519=> 2
 520 => 3
  521 => 3
]

I do not know if it is possible or not like

You can use built in function array_combine to achieve this:

$arr1 =array(
  0 => 518,
  1 => 519,
  2 => 520,
  3 => 521,
);

$arr2 =array(
  0 => "1",
  1 => "2",
  2 => "3",
  3 => "3",
);
$new_array = array_combine($arr1,$arr2);
print_r($new_array);

DEMO

You can loop through and use the key to associate between your arrays. You have a little type juggling to do.

<?php
$one = 
[
  0 => 518,
  1 => 519,
  2 => 520,
  3 => 521
];

$two = 
[
  0 => "1",
  1 => "2",
  2 => "3",
  3 => "3"
];

$desired =
[
  518 => 1,
  519 => 2,
  520 => 3,
  521 => 3
];

foreach($one as $k=>$v)
{
    $out[$v] = (int) $two[$k];
}    

if($desired === $out) {
    echo 'All good.';
}

Output:

All good.