Hi i want to change the last 4 digits of number with asterisk
For example: 123456789101
I want it to become 12345678**** in database (PHPMyAdmin)
This is my code
if(isset($_POST['add'])){
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
$voter = $_POST['voters_id']; (**I want the voters_id to be asterisk only last 4 digits**)
}
$sql = "INSERT INTO voters (voters_id, password) VALUES ('$voter', '$password')";
if($conn->query($sql)){
echo '<script language="javascript">';
echo 'alert("Voters sucessfully insert")';
echo '</script>';
echo ("<script>location.href='index.php'</script>");
}
else{
$_SESSION['error'] = $conn->error;
}
}
Is there any idea on how to solve this problem? Thank you in advance!
2
Answers
Edited it to match what you want; here ya go:
Input:
Output
Live Demo: http://sandbox.onlinephpfunctions.com/code/3ad1e3e028e696b1e8befe5e9a971ba468ba4d9e
I just don’t understand how you’re going to get the original numbers back from the asterisks but to each is their own lol.
Use this
credits to https://beta.openai.com/playground