如何在PHP中将多个十进制值转换为十六进制

Hi all i tried searching a bit but didnt found anything which will help me precisely please help me this is last thing which will help my program authentication system to get going i am trying to scan for users base ID , now BaseID is stored in my database i fetch it via sql and from there read it from my program ( made in Lua ) problem is i cant directly scan the BaseID its in 4byte format and gives too many results instead if i convert it in hex form it works well , i want to convert it in hex format at server using php so as soon as its fetched it gets converted in hex so i need help in conversion script i am unable to do it atm i use

$BaseID = ''
$BaseIDHex = dechex($BaseID);
{
   echo $BaseIDHex;
}

its does what i need partially

suppose my BaseID was 1234567890 it gives me Output as : 499602D2 but i want it in this form : D2 02 96 49 ( inverted and space in between )


Update : New question added in same one

$BaseID  = '';
$BaseID  = $row1['field_12'];
$Addition = ' 00 00 00 00 00 00 00 00 00"';
$BaseIDHex = dechex($BaseID);
$result = '';
while(strlen($BaseIDHex) >=2){
    $result = strtoupper($result.substr($BaseIDHex, -2))." ";
    $BaseIDHex = substr($BaseIDHex, 0, strlen($BaseIDHex)-2);
}
echo 'check = "';
echo trim($result);
echo $Addition;

it pritns me check = "B9 09 EE 00 00 00 00 00 00 00 00 00"

It works perfectly now i want to make some changes in the above code the $BaseID was 1 no. 15600057 but sometimes i have multiple ids stored in db like 15600057,12600057 any idea how i convert both of them into hexstring and echo them in the same way show in the above code ? so it echoes the final result like this

check = "B9 09 EE 00 00 00 00 00 00 00 00 00" check1 = "C9 56 fe 00 00 00 00 00 00 00 00 00" ??

@Shankar Damodaran 's code looks way cleaner(+1) but i'd still want to post my version

$BaseID = '1234567890';
$BaseIDHex = dechex($BaseID);
$result = '';
while(strlen($BaseIDHex) >=2){
    $result = strtoupper($result.substr($BaseIDHex, -2))." ";
    $BaseIDHex = substr($BaseIDHex, 0, strlen($BaseIDHex)-2);
}
echo trim($result);

Do this way..

$BaseID = '1234567890';
$BaseIDHex = dechex($BaseID);
echo $v = implode(' ',array_reverse(explode(' ',strtoupper(wordwrap($BaseIDHex, 2, " ", true)))));

Demonstration