PHP:根据其他字符串从字符串中分解数据

I am trying to get the value of Split Parts.

My code is:

<?php 
$password = "03,10,05,07,17,23";

$string = "::3:8:1::5::2:9::::6:::4::::::0:";

$string = explode(':', $string);

How to do print $string by order of $password

$string[03],$string[10],$string[05],$string[07],$string[17],$string[23]

Result Need : 391540

Here you goes Live demo

$password = "03,10,05,07,17,23";

$string = "::3:8:1::5::2:9::::6:::4::::::0:";

$pass = explode(',', $password);
$code = explode(':', $string);

$result = '';
foreach ($pass as $pos) {
    $pos = ((int)$pos)-1;
    $result .= $code[$pos];
}

echo $result;