<?php
function mascararId($id_sem_mask) {
return MASK_SUM + $id_sem_mask;
}
function desmascararId($id_com_mask) {
return $id_com_mask - MASK_SUM;
}
$id = 10;
$maskId = mascararId($id);
echo 'Original:', $id, PHP_EOL;
echo 'Mascarado:', $maskId, PHP_EOL;
echo 'Desmascarado:', desmascararId($maskId);
PD9waHAKZGVmaW5lKCdNQVNLX1NVTScsIDEyODg5MDApOwoKZnVuY3Rpb24gbWFzY2FyYXJJZCgkaWRfc2VtX21hc2spIHsKICAgIHJldHVybiBNQVNLX1NVTSArICRpZF9zZW1fbWFzazsKfQoKZnVuY3Rpb24gZGVzbWFzY2FyYXJJZCgkaWRfY29tX21hc2spIHsKICAgIHJldHVybiAkaWRfY29tX21hc2sgLSBNQVNLX1NVTTsKfQoKCiRpZCA9IDEwOwoKJG1hc2tJZCA9IG1hc2NhcmFySWQoJGlkKTsKCmVjaG8gJ09yaWdpbmFsOicsICRpZCwgUEhQX0VPTDsKZWNobyAnTWFzY2FyYWRvOicsICRtYXNrSWQsIFBIUF9FT0w7CmVjaG8gJ0Rlc21hc2NhcmFkbzonLCBkZXNtYXNjYXJhcklkKCRtYXNrSWQpOw==