Anvar Freelance Web Designer and SEO Expert Logo
01 / 01
WhatsApp Logo +91 808 999 0405

How to show last digit number with php jquery

You can simply hide and show the last digit numbers with jQuery php and css.
Here is the script to hide and show the last 4 digit of the string

<?php
echo "Hello World";
$no = "+97152432XXXX";
$hide = substr($no, -4);
$shono = substr($no, 0, -4);
echo $hide;
?>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.js"></script>
<link rel="stylesheet" type="text/css"
href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/ui-lightness/jquery-ui.css">
<div id="number" data-last="<?php echo $hide ?>">
<?php echo $shono; ?><span>show</span></div>
<script>
$('#number').click(function() {
 $(this).find('span').text( $(this).data('last') );
});
</script>
by anvar
Published : Oct , 12

Post a comment

Your email address will not be published. Required fields are marked *